获取关于android中最顶级父级的视图位置

Cot*_*nyo 7 android android-layout

要获得视图相对于其父,我可以使用getLeft(),getRight(),getTop(),和getBottom().但是如何获得相对于布局文件最顶层父级的视图?所以说我的前夕布局是RelativeLayout.然后在前夕说我有许多嵌套布局.然后深入层次结构中我有一个EditText视图.如何获得关于前夕的EditText视图的位置?

Soc*_*ror 8

要找出绝对视图位置,您可以使用view.getLocationOnScreen()view.getLocationInWindow().