本文介紹了Android:BottomSheetDialog內的多行文本EditText的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我有一個底部工作表對話框,并且在布局中存在 EditText.EditText 是多行的,最大行數是 3.我放了:
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);
但是當用戶開始垂直滾動 EditText 的文本時,BottomSheetBehavior 攔截事件并且 EditText 不會垂直滾動.
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?
推薦答案
這是一個簡單的方法.
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;
}
});
這篇關于Android:BottomSheetDialog內的多行文本EditText的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!