Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the X Y coordinates and pixel size of a TextView?

Given a TextView, is it possible to know at runtime the X and Y coordinates of where it is drawn? Is it also possible to know the size (width/length) in pixels?

like image 527
michelemarcon Avatar asked Oct 26 '11 15:10

michelemarcon


1 Answers

There are getLeft(), getTop(), getWidth(), getHeight() methods for a view, it works for textView too. for more information , see the following link...

getLeft() and getTop() will return you the starting x,y co-ordinates.

http://developer.android.com/reference/android/view/View.html

like image 82
Yashwanth Kumar Avatar answered Sep 30 '22 13:09

Yashwanth Kumar