Closed DavidBarbaran closed 4 years ago
@DavidBarbaran, Its because ExpandableItem intercept touch. You need block touch listener in ExpandableItem headerLayout, like so
val item: ExpandableItem = v.findViewById(R.id.row) as ExpandableItem
holder.item.headerLayout.setOnTouchListener(null)
and move expand logic from library in your code
holder.item.setOnClickListener {
val currentPosition = holder.layoutPosition
val tg = ExpandableItem::class.java.canonicalName
for (index in 0 until layout.childCount) {
if (index != currentPosition - layout.findFirstVisibleItemPosition()) {
val currentExpandableItem: ExpandableItem = layout.getChildAt(index)!!.findViewWithTag(tg)
currentExpandableItem.hide()
}
}
if (holder.item.isOpened) {
holder.item.hide()
} else {
holder.item.show()
}
}
Wow it's been so long 😮
Thanks for taking the time to respond, I'm sure it will help someone who has the same problem 🤝
I wanted to implement a listener in your code to perform an action when the content is displayed, and making use of the log, I realized that the onclicklistener in ExpandableRecyclerView is only called once, it can not do an action when the content is hidden and only when it shows Is there any way to do this? That is to say perform a certain action when it is displayed and hidden, in my case I am trying to make a notifyDataSetChanged () making use of this listener that implements.
Your code and my listener implementation
`
`
My code onBindViewHolder in Adapter
`
`