Android之解决scrollview总是优先滑动,导致在scrollview内的控件不滑动问题

 sv01 = (ScrollView) findViewById(R.id.popup_sf_event_scroll_01); 
    sv02 = (ScrollView) findViewById(R.id.popup_sf_event_scroll_02); 

    sv02.setOnTouchListener(new OnTouchListener() { 

        @Override 
        public boolean onTouch(View v, MotionEvent event) { 
            if (event.getAction() == MotionEvent.ACTION_UP) 
                sv01.requestDisallowInterceptTouchEvent(false); 
        else  
                sv01.requestDisallowInterceptTouchEvent(true); 

        return false; 
        } 
    }); 



重写onTouch()事件,在事件里通过requestDisallowInterceptTouchEvent(boolean)方法来设置父类的不可用,true表示父类的不可用

 

你可能感兴趣的:(scrollview)