Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void getAbsCoord(int resId) {
- View v = findViewById(resId);
- if (v == null)
- throw new IllegalArgumentException("this is not a view");
- Rect r = new Rect();
- v.getGlobalVisibleRect(r); //RootView 레이아웃을 기준으로한 좌표.
- //custom Log
- Log.l(v.getResources().getResourceName(resId).split(":")[1]
- + " 의절대좌표::", r.left, r.top, r.right, r.bottom);
- }
- //to use _ view가 생성된 이후에 실행
- getAbsCoord(R.id.resId);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement