I have the following problem. On my layout I have an action bar (which takes for example 150dp height) and the rest is ListView.
I'm able to grab some view from action bar and drag it onto listview. Dragging is implemented through windowsmanager. So when dragging I am getting rawY coordinates. Now, I want to match rawY with ListView relative coordinates, so I would know above what item in ListView I'm currently hovering.
Is there any possibility to do this?
Yes: getChildAt will give you the individual view of any item in the list. getLocationOnScreen gives raw screen coordinates of a view. getWidth and getHeight will establish your bounding box. getFirstVisiblePosition and getLastVisiblePosition establish indexes in the list to search within.
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