Alternative PointToPosition for RecycleView

I am replacing ListView with RecyclerView , but I am using the pointToPosition method , is there any equivalent?


+4
source share
2 answers

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) .

+5
source

This will give you an idea in (x, y) in the parent RecyclerView:

View targetView = recyclerView.findChildViewUnder(x, y);

, :

recyclerView.getChildAdapterPosition(targetView);
+3

All Articles