Reputation: 715
I want to get absolute coordinates (X, Y) of an item in a GridView.
I have position of this item in the GridView.
How can I get X, Y of this Item on the screen?
I wish there was positionToPoint
instead of pointToPosition
!
Upvotes: 3
Views: 1149
Reputation: 4791
As far as i understand your question ,you can use pointToPosition method , available in GridView Android API
if (myGridView.pointToPosition((int)e.getX(), (int)e.getY())!=-1) {
myItem = myGridViewAdapter.getItem(myGridView.pointToPosition((int)e.getX(), (int)e.getY()));
}
Upvotes: 1