Android : Multi line text EditText inside BottomSheetDialog

android, android-edittext, bottom-sheet, scroll

Solution

Here is an easy way to do it.

yourEditTextInsideBottomSheet.setOnTouchListener(new OnTouchListener() {
  public boolean onTouch(View v, MotionEvent event) {
        v.getParent().requestDisallowInterceptTouchEvent(true);
        switch (event.getAction() & MotionEvent.ACTION_MASK){
        case MotionEvent.ACTION_UP:
            v.getParent().requestDisallowInterceptTouchEvent(false);
            break;
        }
        return false;
   }
});

Problem

I have a bottom sheet dialog and exists EditText in layout. EditText is multiline, max lines is 3. I put : ``` commentET.setMovementMethod(new ScrollingMovementMethod()); commentET.setScroller(new Scroller(bottomSheetBlock.getContext())); commentET.setVerticalScrollBarEnabled(true); ``` but when user will begin scrolling text of EditText vertically BottomSheetBehavior intercept event and EditText will not scroll vertically. Anybody know how to solve this problem?

Original source