Gets the location of the view class interface control to help you add a new control.
Gets the relative coordinate position in the parent
This is relatively simple, needless to say, directly call the method of view: GetLeft, GetTop, Getbottom, GetRight obtained.
Get the absolute position in the screen
Getlocalvisiblerect
Getglobalvisiblerect
The method is to construct a rect to "set" the view. The coordinates of this rect are relative to the current activity.
For normal activity, the top of the rect is the visible status bar height + the distance from the upper left corner to the bottom of the title bar of the visible title bar height +rect.
For dialog-style activity, the y-coordinate is the top of the rect that is visible, the distance from the upper-left corner to the bottom of the title bar for the +rect height of the title bar.
At this point there is no disregard for the status bar.
Getlocationinwindow
This method stores the upper-left coordinate of the view in an array. This coordinate is relative to the current activity.
For normal activity, the y-coordinate is the visible status bar height + visible title bar height +view the upper-left corner to the bottom of the title bar.
In the case of hidden status bar/title bar, their height is calculated at 0.
For dialog-style activity, the y-coordinate is the distance from the visible title bar height +view to the bottom of the title bar.
At this point there is no disregard for the status bar.
Getlocationonscreen
This method is similar to the above, and it also stores the upper-left corner of the view in the array. But this coordinate is relative to the entire screen.
The y-coordinate is the distance from the upper-left corner of the view to the top of the screen.
Where to get view in Android app