Reputation: 1026
Assuming that I have a TextView with text inside. Is it possible to get from that TextView some word's coordinates on the screen?
Upvotes: 0
Views: 2653
Reputation: 2569
I had the same problem and I have resolved it. You have to use clickableSpan inside your TextView. See my post for more details, and tell me if you have any problem :)
Upvotes: 1
Reputation: 599
Here goes
TextView tv;
int[] coordinates = new int[2];
tv.getLocationOnScreen(coordinates);
Log.v("Coordinates of my TextView are: ", "Left(X) = "+coordinates[0]+" and Top(Y) = "+coordinates[1]);
Hope it helped))) Actually, it works for any view - not only a TV.
Upvotes: 1