Item click event in Android recyclerview?

Asked 2 years ago, Updated 2 years ago, 23 views

If you click Recycler View and set addOnItemTouchListener to receive the event

Recycler view. Wherever you click, there's an event

By the way, what should I do to receive the event when I click the button in the recyclubview?

I installed setOnClickListener in the onBindViewHolder of the RecyclerView Adapter

Even if you click the button, the onItemClick event of the Recyclerview occurs

However, if you double-click the button in the recycluster view, the onItemClick event is called.

SetOnClickListener event is called.

How do I receive a click event for the button in the Recycler View?

Thank you^

^

android

2022-09-21 18:47

1 Answers

If you haven't done anything about touch, it's not common for a click event to occur only when you click twice in a row quickly, so I don't think I can give you a clear answer. For these questions, we recommend that you attach a code if possible :)

For the click event of each item, I would like to recommend how to create and use a custom listener instead of OnItemTouchListener.

It would be helpful to refer to the link below. https://stackoverflow.com/questions/24885223/why-doesnt-recyclerview-have-onitemclicklistener


2022-09-21 18:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.