我在scrollview中有一个scrollview. xml是这样的
<RelativeLayout .... <ScrollView..... <RelativeLayout .... <Button..... <Button .... <ScrollView <RelativeLayout .... .......... </RelativeLayout> </ScrollView> </RelativeLayout> </ScrollView> </RelativeLayout>
解决方法
试试这个代码.它对我有用
parentScrollView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v,MotionEvent event) { findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(false); return false; } }); childScrollView.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v,MotionEvent event) { // Disallow the touch request for parent scroll on touch of // child view v.getParent().requestDisallowInterceptTouchEvent(true); return false; } });`