Meh*_*hdi 2 android listview android-listview android-recyclerview
我正在构建一个Android应用程序,现在它有一个主要的回收站视图(填充了项目,这些项目是使用item.xml布局的),并且在每个item.xml中都有一个listView.
如何在此列表视图中进行滚动工作,因为现在应用程序只是监听回收器视图的滚动?
我试过下面这行,但它不起作用:
android:nestedScrollingEnabled="true"
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助:)!
小智 5
我这样解决了:
mRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
if(rv.getChildCount() > 0) {
View childView = rv.findChildViewUnder(e.getX(), e.getY());
if(rv.getChildPosition(childView) == [listview position]) {
int action = e.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
rv.requestDisallowInterceptTouchEvent(true);
}
}
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
});
Run Code Online (Sandbox Code Playgroud)