I'm replacing a ListView by the RecyclerView, but I'm using a pointToPosition method, is there any equivalent?
For RecyclerView you have findChildViewUnder (float x, float y). This method returns a child View which you can then use to retrieve the adapter position using getChildAdapterPosition(View child).
This will get you the View at (x, y) in the parent RecyclerView:
View targetView = recyclerView.findChildViewUnder(x, y);
And this gets you the position of the item within the underlying data set currently represented by that View:
recyclerView.getChildAdapterPosition(targetView);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With