我在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;
}
});`