Android examples for User Interface:StatusBar
get StatusBar Height from Window
//package com.java2s; import android.app.Activity; import android.graphics.Rect; import android.view.Window; public class Main { public static int getStatusBarHeight(Activity activity) { if (activity == null) { return 0; }//from w ww . j av a 2 s . c o m Rect windowDisplayFrame = new Rect(); Window window = activity.getWindow(); if (window == null) { return 0; } window.getDecorView().getWindowVisibleDisplayFrame( windowDisplayFrame); return windowDisplayFrame.top; } }