取得View在屏幕上的位置

获得View在屏幕上的位置

android.view.View

 

public void getLocationOnScreen (int[] location)

Since: API Level 1

 

Computes the coordinates of this view on the screen. The argument must be an array of two integers. After the method returns, the array contains the x and y location in that order.

 

Parameters
location
an array of two integers in which to hold the coordinates