I have a bottom sheet dialog and exists EditText in layout. EditText is multiline, max lines is 3. I put :
commentET.setMovementMethod(new ScrollingMovementM
I solve this issues with following way:
I created custom work around bottom sheet behavior extends native android BottomSheetBehavior:
public class WABottomSheetBehavior extends BottomSheetBehavior {
private boolean mAllowUserDragging = true;
public WABottomSheetBehavior() {
super();
}
public WABottomSheetBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setAllowUserDragging(boolean allowUserDragging) {
mAllowUserDragging = allowUserDragging;
}
@Override
public boolean onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) {
if (!mAllowUserDragging) {
return false;
}
return super.onInterceptTouchEvent(parent, child, event);
}
}
then set touch event of EditText and when user touching area of EditText I will be disable handling event by parent with calling method setAllowUserDragging :
commentET.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.commentET) {
botSheetBehavior.setAllowUserDragging(false);
return false;
}
return true;
}
});