Android examples for User Interface:StatusBar
get StatusBar Height without using reflection
//package com.java2s; import android.content.Context; import android.view.WindowManager; public class Main { public static int getStatusBarHeight(Context context) { int statusBarHeight = 0; int screenHeight = getScreenSize(context)[1]; switch (screenHeight) { case 240: statusBarHeight = 20;//from w ww. j a v a2 s . co m break; case 480: statusBarHeight = 25; break; case 800: statusBarHeight = 38; break; default: break; } return statusBarHeight; } public static int[] getScreenSize(Context context) { WindowManager wm = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); int width = wm.getDefaultDisplay().getWidth(); int height = wm.getDefaultDisplay().getHeight(); int[] size = { width, height }; return size; } }