Get the Height of ActionBar

android

Solution

I found the alternative of `ActionBar.getHeight()` If anyone facing the same issue then this link is useful.

While @birdy's answer is an option if you want to explicitly control the ActionBar size there is a way to pull it up without locking the size that I found in support documentation. It's a little awkward but it's worked for me. You'll need a context, this example would be valid in an Activity. ~ Anthony

// Calculate ActionBar's height 
TypedValue tv = new TypedValue(); 
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
    actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()); 
}

Problem

I am using Actionbar in my application. I want the Height of the ActionBar programatically hence I am using : ``` ActionBar.getHeight(); ``` But I am getting 0 value of Height. So How can I get the Height of ActionBar?

Original source

Related problems