Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. public void getAbsCoord(int resId) {
  2.  
  3. View v = findViewById(resId);
  4. if (v == null)
  5. throw new IllegalArgumentException("this is not a view");
  6.  
  7. Rect r = new Rect();
  8. v.getGlobalVisibleRect(r); //RootView 레이아웃을 기준으로한 좌표.
  9.  
  10. //custom Log
  11. Log.l(v.getResources().getResourceName(resId).split(":")[1]
  12. + " 의절대좌표::", r.left, r.top, r.right, r.bottom);
  13. }
  14.  
  15. //to use _ view가 생성된 이후에 실행
  16. getAbsCoord(R.id.resId);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement