Android中滚动视图中的滚动视图 [英] Scrollview inside a scrollview in android issue
本文介绍了Android中滚动视图中的滚动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在scrollview中有一个scrollview.xml就是这样
I have a scrollview inside a scrollview . The xml is like this
<RelativeLayout ....
<ScrollView.....
<RelativeLayout ....
<Button.....
<Button ....
<ScrollView
<RelativeLayout ....
..........
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
在第二个滚动视图中滚动不流畅.可以为此提供解决方案.我尝试了互联网上提供的许多解决方案,但没有用.
in this second scrollview in not scrolling smoothly. can give a solution for that. I tried a lot of solution given in the internet but not working.
推荐答案
尝试此代码.它对我有用`
Try this code. It is working for me`
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;
}
});`
这篇关于Android中滚动视图中的滚动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文