控件在屏幕上的绝对坐标获取方法:以屏幕左上角为坐标原点
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;
        }
    }  





相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-11-01
  • 2021-09-29
  • 2021-08-01
  • 2022-12-23
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
相关资源
相似解决方案