Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import android.util.TypedValue; public class Main { public static int getSystemUiActionBarHeight(Activity activity) { final TypedValue typedValue = new TypedValue(); if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, typedValue, true)) { return TypedValue.complexToDimensionPixelSize(typedValue.data, activity.getResources().getDisplayMetrics()); } return -1; } }