我不得不提高Deepthi的解决方案,因为它没有为我工作的父类;我猜是因为我的孩子scrollview充满了意见(我的意思是子视图使用所有的scrollview绘图空间)。为了使其充分发挥功能,我只好也不允许对孩子滚动视图内所有儿童的意见触摸母公司滚动触摸请求:
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;
}
});`
childScrollviewRecursiveLoopChildren(parentScrollView, childScrollView);
public void childScrollviewRecursiveLoopChildren(final ScrollView parentScrollView, View parent) {
for (int i = ((ViewGroup) parent).getChildCount() - 1; i >= 0; i--) {
final View child = ((ViewGroup) parent).getChildAt(i);
if (child instanceof ViewGroup) {
childScrollviewRecursiveLoopChildren(parentScrollView, (ViewGroup) child);
} else {
child.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event)
{
// Disallow the touch request for parent scroll on touch of
// child view
parentScrollView.requestDisallowInterceptTouchEvent(true);
return false;
}
});
}
}
}
我不认为内滚动视图滚动视图将工作 – KOTIOS
u能告诉我确切requirrrnt – KOTIOS
它不是一个很好的做法,有2个scrollViews在相同的方向相互滚动,即使它工作 –