How to scroll the edittext inside the scrollview

前端 未结 12 2011
南笙
南笙 2020-12-02 10:27

I have a scrollview inside which there is a editext which is multiline. I want to scroll the edittext to see the lower content but it can\'t be done.

12条回答
  •  余生分开走
    2020-12-02 11:03

    First add this at XML

    android:scrollbarStyle="insideInset"
    android:scrollbars="vertical" 
    android:overScrollMode="always"
    

    Then add the same above "OnTouch" but make it return "false" not "true"

    public boolean onTouch(View view, MotionEvent event) {
    
                        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;
    }
    

提交回复
热议问题