Android examples for User Interface:ActionBar Size
get ActionBar Height Compat
import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; import android.os.Build; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.util.TypedValue; import android.widget.FrameLayout; public class Main{ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private static int getActionBarHeightCompat( ActionBarActivity actionBarActivity) { TypedValue tv = new TypedValue(); Resources.Theme activityTheme = actionBarActivity.getTheme(); boolean resolved = false; if (activityTheme != null) { resolved = activityTheme.resolveAttribute( android.R.attr.actionBarSize, tv, true); }/* w ww.ja v a2 s.co m*/ return resolved ? actionBarActivity.getResources() .getDimensionPixelSize(tv.resourceId) : 40; } }