Android:BottomSheetDialog内的多行文本EditText [英] Android : Multi line text EditText inside BottomSheetDialog

查看:23
本文介绍了Android:BottomSheetDialog内的多行文本EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个底部工作表对话框,并且在布局中存在 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆