我有一个父级RecyclerView,里面嵌套了子级RecyclerView项目。问题是我只点击父项的非子RecyclerView部分来触发父RecyclerView的click事件。单击子RecyclerView项将拦截click事件。我想知道如何取消孩子RecyclerView项目的点击拦截并通过点击它。转到父级RecyclerView项目,以便我可以显示wave效果并触发唯一的click事件,而不管父级RecyclerView项目中的区域。
这是我的适配器代码:
parentAdapter.setOnItemClickListener { _, _, position ->
val bundle = Bundle()
bundle.putSerializable("record", recordAdapter.data[position])
ActivityUtils.startActivity(bundle, RecordDetailActivity::class.java)
}
父适配器
class RecordAdapter : BaseQuickAdapter<Record, BaseViewHolder>(R.layout.item_record) {
override fun convert(helper: BaseViewHolder, item: Record) {
...
val adapter = ChildAdapter()
val recyclerView = helper.getView<RecyclerView>(R.id.item_record_product_rv)
recyclerView.layoutManager = LinearLayoutManager(mContext)
recyclerView.addItemDecoration(DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL))
adapter.bindToRecyclerView(recyclerView)
adapter.setNewData(item.productInfo)
}
}
子适配器
class RecordProductAdapter : BaseQuickAdapter<RecordProduct<String, String, Double, Int>, BaseViewHolder>(R.layout.item_record_product) {
override fun convert(helper: BaseViewHolder, item: RecordProduct<String, String, Double, Int>) {
...
}
}