得到状态栏高度

Rect rectgle= new Rect(); 
Window window= getWindow(); 
window
.getDecorView().getWindowVisibleDisplayFrame(rectgle); 
int StatusBarHeight= rectgle.top; 
int contentViewTop=  
    window
.findViewById(Window.ID_ANDROID_CONTENT).getTop(); 
int TitleBarHeight= contentViewTop - StatusBarHeight; 
 
   
Log.i("*** Jorgesys :: ", "StatusBar Height= " + StatusBarHeight + " , TitleBar Height = " + TitleBarHeight);  

你可能感兴趣的:(android)