나의 플랫폼/안드로이드

[ Android ] 타이틀 바 높이 확인 방법

GsBOB 2011. 10. 13. 12:26

Rect rect= new Rect();

        ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)).

        Window window= activity.getWindow();

        window.getDecorView().getWindowVisibleDisplayFrame(rect);

        int statusBarHeight= rect.top;

        int contentViewTop= 

            window.findViewById(Window.ID_ANDROID_CONTENT).getTop();

        int titleBarHeight= contentViewTop - statusBarHeight;

출처 : http://andmobidev.blogspot.com/2010/01/getting-height-of-status-and-title-bar.html

기종 별로 타이틀 바 높이가 틀리니
이런 우회 방법으로 확인해야할듯^^