I have a RecyclerView (which uses a GridLayoutManager) inside a HorizontalScrollView. I do this to allow scrolling in both directions. When the user scrolls (either direction), I need to get the position of the selected element in the RecyclerView (I keep track of the selected element using an ItemClick event). I get the position using the
GetLocationOnScreen method. This works fine when the element is onscreen, but when it gets scrolled offscreen, I end up with problems. What I do with the data from
GetLocationOnScreen is use it in the
OnDraw override of a custom view. However, because the values from
GetLocationOnScreen are negative when the element is offscreen, the result does not display as expected. What should I do?