- 解决recyclerview滑动冲突,修复CollapsingT
- 解决BottomSheetDialog与RecyclerView
- RecyclerView的item中嵌套Scrollview的滑
- NestedScrollView+RecyclerView
- android的RecyclerView嵌套在NestedScr
- android解决RecyclerView嵌套在NestedSc
- Android ScrollView嵌套Recyclerview
- RecyclerView解决滑动冲突
- Android ScrollView 嵌套RecyclerVie
- Scrollview和RecyclerView滑动冲突问题解决
场景:
布局xml有个CollapsingToolbarLayout,竖向滑动recycleview包裹多个子item是横向滑动recycleview。
滑动冲突,子item是横向滑动recycleview,它可以横向滑动,会把事件消费掉.这样CollapsingToolbarLayout就不会响应折叠.大的recyclerview不会出现滑动.
解决方案:
/**
* Enable nested scrolling.
*
* <p>This is a delegate method. Call it from your {@link android.view.View View} subclass
* method/{@link android.support.v4.view.NestedScrollingChild} interface method with the same
* signature to implement the standard policy.</p>
*
* @param enabled true to enable nested scrolling dispatch from this view, false otherwise
*/
public void setNestedScrollingEnabled(boolean enabled) {
if (mIsNestedScrollingEnabled) {
ViewCompat.stopNestedScroll(mView);
}
mIsNestedScrollingEnabled = enabled;
}
大意:启用嵌套滚动,参数启用为true以从此视图启用嵌套滚动调度,否则为false
内部嵌套的recyclerview调用setNestedScrollingEnabled(false);
就可以解决了.
网友评论