Android EditText Vertical Scrolling Problem

后端 未结 5 1709
猫巷女王i
猫巷女王i 2020-12-06 03:20

I\'m using an EditText of some predefined size, however when a user enters more text then fits in the text box, they aren\'t able to scroll the text with touch. Scrolling do

5条回答
  •  -上瘾入骨i
    2020-12-06 03:54

    In java

     EditText dwEdit = (EditText) findViewById(R.id.DwEdit);       
     dwEdit.setOnTouchListener(new OnTouchListener() {
           public boolean onTouch(View view, MotionEvent event) {
                // TODO Auto-generated method stub
                if (view.getId() ==R.id.DwEdit) {
                    view.getParent().requestDisallowInterceptTouchEvent(true);
                    switch (event.getAction()&MotionEvent.ACTION_MASK){
                    case MotionEvent.ACTION_UP:
                        view.getParent().requestDisallowInterceptTouchEvent(false);
                        break;
                    }
                }
                return false;
            }
        });
    

    In xml

    
     
    

提交回复
热议问题