- RecyclerView的item中嵌套RecyclerView
- RecyclerView的item中嵌套Scrollview的滑
- 解决 Recyclerview 嵌套 Recyclerview,
- 解决ScrollView嵌套RecyclerView出现item
- RecyclerView嵌套滑动异常处理
- AndroidRecyclerView中的Item嵌套Recyc
- RecyclerView的item中嵌套RecyclerView
- RecyclerView的item中嵌套RecyclerView
- recyclerview嵌套recyclerview ,焦点被抢
- RecyclerView嵌套导致item复用界面会显示异常的问题
RecyclerView的item中嵌套RecyclerView的滑动冲突解决
mBinding.rvBrand.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener {
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
}
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
// 外层RV滑动与内层布局滑动冲突解决
// 找到被点击位置的item的rootView
val itemView = rv.findChildViewUnder(e.x, e.y)
if (itemView != null) {
// 通过rootView找到对应的ViewHolder
val holder = rv.getChildViewHolder(itemView)
val recyclerViewSmallCoupon = holder.itemView.recyclerViewSmallCoupon
recyclerViewSmallCoupon?.let {
recyclerViewSmallCoupon.requestDisallowInterceptTouchEvent(true)
}
}
return false
}
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {
}
})
网友评论