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?
Just add this android:inputType="textMultiLine" in XML file on relevant field. Save this answer.
February 19, 2021. Bottom Sheet dialogs seem to be replacing regular Android dialogs and menus. The Bottom Sheet is a component that slides up from the bottom of the screen to showcase additional content in your application. A Bottom Sheet dialog is like a message box triggered by the user's actions.
BottomSheetDialogFragment bottomSheetFragment = new YourBottomSheetFragmentClass(); bottomSheetFragment. show(getFragmentManager(), bottomSheetFragment. getTag()); Or if you want to pass some data to BottomSheetDialogFragment use below code, with newInstance you can send and retrieve data.
For those who are interested in Kotlin solution. Here it is
editText.setOnTouchListener { v, event ->
v.parent.requestDisallowInterceptTouchEvent(true)
when (event.action and MotionEvent.ACTION_MASK) {
MotionEvent.ACTION_UP ->
v.parent.requestDisallowInterceptTouchEvent(false)
}
false
}
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;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With