控件在屏幕上的绝对坐标获取方法:以屏幕左上角为坐标原点
int[] location = new int[2];
view.getLocationInWindow(location );
getLocationOnScreen的源码:
public void getLocationOnScreen(int[] location) {
getLocationInWindow(location);
final AttachInfo info = mAttachInfo;
if (info != null) {
location[0] += info.mWindowLeft;
location[1] += info.mWindowTop;
}
}