本文介紹了Android:BottomSheetDialog內(nèi)的多行文本EditText的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時(shí)送ChatGPT賬號(hào)..
我有一個(gè)底部工作表對(duì)話框,并且在布局中存在 EditText.EditText 是多行的,最大行數(shù)是 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);
但是當(dāng)用戶開始垂直滾動(dòng) EditText 的文本時(shí),BottomSheetBehavior 攔截事件并且 EditText 不會(huì)垂直滾動(dòng).
but when user will begin scrolling text of EditText vertically BottomSheetBehavior intercept event and EditText will not scroll vertically.
有人知道如何解決這個(gè)問題嗎?
Anybody know how to solve this problem?
推薦答案
這是一個(gè)簡(jiǎn)單的方法.
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;
}
});
這篇關(guān)于Android:BottomSheetDialog內(nèi)的多行文本EditText的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!