如何获取TextView的XY坐标和像素大小?

mic*_*con 7 android pixel textview coordinates

给定a TextView,是否可以在运行时知道绘制位置的X和Y坐标?是否也可以知道像素的大小(宽度/长度)?

Yas*_*mar 14

getLeft(),getTop(),getWidth(),getHeight()为视图方法,它适用于TextView的了.有关更多信息,请参阅以下链接...

getLeft()并且getTop()将返回起点的x,y坐标.

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

  • 这些返回相对于父级的位置,而不是绝对位置. (4认同)
  • 这给了我总值'0'.这对我没有帮助,你能帮助我吗?建议任何其他解决方案PLZ. (2认同)