我在 Android 1.6 和 2.2 中这样做 ...
我在 Activity 中有一个 ScrollView(ScrollView 中的所有内容)...
第二个是 Activity 中的一个 ListView....
当我滚动 ListView 时,那时 ScrollView 正在滚动,但是 ListView 的滚动不工作 ...
我提供了我遇到的问题的scatch ...
如果有人对此有解决方案,请分享...
最佳答案
这里 parentScroll = 你的主 ScrollView 和 childScroll = 你的 ListView
parentScroll.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Log.v("PARENT", "PARENT TOUCH");
findViewById(R.id.child_scroll).getParent()
.requestDisallowInterceptTouchEvent(false);
return false;
}
});
childScroll.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Log.v("CHILD", "CHILD TOUCH");
// Disallow the touch request for parent scroll on touch of
// child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
关于android - 如何工作,当 ListView 在 ScrollView 中时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15062365/