0

I was looking for get the height of my actionbar(sherlock). The value returned is 0.

value/styles.xml (and for value11 I used "android:actionBarSize")

<style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarStyle">@style/Widget.AppTheme.ActionBar</item>
    <item name="actionBarSize">48dip</item>
</style>

code :

getSupportActionBar().getHeight()
MadCode
  • 7
  • 1
  • 6

1 Answers1

0

This didn't work?

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

ref: How to get the ActionBar height?

Community
  • 1
  • 1
puj
  • 770
  • 5
  • 9
  • Have you tried after your view has been layed out? For instance, in `onResume`? – puj Mar 14 '15 at 23:30