ScrollView 嵌套EditText(EditText滚动焦点问题)

            parentScrollView.setOnTouchListener(new View.OnTouchListener() {

                    public boolean onTouch(View v, MotionEvent event) {
                        Log.v(TAG,"PARENT TOUCH");
                        findViewById(R.id.child_scroll).getParent().requestDisallowInterceptTouchEvent(false);
                        return false;
                    }
                });

                

     childScrollView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { Log.v(TAG,"CHILD TOUCH"); // Disallow the touch request for parent scroll on touch of child view v.getParent().requestDisallowInterceptTouchEvent(true); return false; } });



分别重写Parent和Child的OnTouch方法

你可能感兴趣的:(ScrollView 嵌套EditText(EditText滚动焦点问题))