Finding the View location (position) on display (screen) in android

后端 未结 5 452
滥情空心
滥情空心 2020-12-19 04:50

I want to find the view\'s position on the display screen.

To do it, I use the methods such as view.getLeft() ,view.getBottom() , vi

5条回答
  •  执笔经年
    2020-12-19 05:14

    I'm not sure that you can get the position of the view before the layout phase have been done. Once the view is layed out you can use getLocationOnScreen to get the position of the view. getTop and similar only returns the position of the view in its parent.

提交回复
热议问题