안드로이드2013. 1. 19. 01:35

글을 올린 블로거를 생각해서 광고 한번만 클릭해주시면 감사하겠습니다

//스테이터스바 높이

private static final int LOW_DPI_STATUS_BAR_HEIGHT = 19;

private static final int MEDIUM_DPI_STATUS_BAR_HEIGHT = 25;

private static final int HIGH_DPI_STATUS_BAR_HEIGHT = 38;

private static final int X_HIGH_DPI_STATUS_BAR_HEIGHT = 50;

//스테이터스바 사이즈 구하기

WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);

Display display2 = wm.getDefaultDisplay();

DisplayMetrics displayMetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);

mWidth = display2.getWidth();

mHeight = display2.getHeight();

Log.i("width", "mWidth:" + mWidth);

if(mWidth < 480)

{

statusBarHeight = MEDIUM_DPI_STATUS_BAR_HEIGHT;

}

else if(mWidth >= 480 && mWidth < 720)

{

statusBarHeight = HIGH_DPI_STATUS_BAR_HEIGHT;

}

else if(mWidth >= 720 && mWidth <= 800)

{

statusBarHeight = X_HIGH_DPI_STATUS_BAR_HEIGHT;

}

Posted by 퍼플카우D