Android examples for android.app:Status Bar
get Status Bar Height
import java.lang.reflect.Field; import android.app.Activity; public class Main { public static int getStatusBarHeight(Activity activity) { try {//from w w w . ja va 2 s . co m Class<?> clazz = Class.forName("com.android.internal.R$dimen"); Object object = clazz.newInstance(); Field field = clazz.getField("status_bar_height"); int dpHeight = Integer.parseInt(field.get(object).toString()); int pxHeight = activity.getResources().getDimensionPixelSize(dpHeight); return pxHeight; } catch (Exception e1) { e1.printStackTrace(); return 0; } } }