카테고리 없음

안드로이드 화면 PixelSize & dp Size 구하기

[czar] 2012. 12. 12. 15:34

  DisplayMetrics displayMetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int pxWidth  = displayMetrics.widthPixels;
int pxHeight = displayMetrics.heightPixels;

//--- displayMetrics.density : density / 160, 0.75 (ldpi), 1.0 (mdpi), 1.5 (hdpi)
int dipWidth  = displayMetrics.widthPixels  / displayMetrics.density;
int dipHeight = displayMetrics.heightPixels / displayMetrics.density;


http://show.ideatree.kr/pages/?board_content_idx=2854