This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
'Android' 카테고리의 다른 글
[android]Button의 Drawable을 SourceCode로 작성 (0) | 2013.05.15 |
---|---|
[android]Bitmap to NinePatch (0) | 2013.05.13 |
[android]convert intent to string(uri) _ intent를 String(Uri)값으로 변환하기 (0) | 2013.05.06 |
[android]manifest permission constants (0) | 2013.03.05 |
[xml]TextView _ inputType (0) | 2013.02.28 |