How to get the ActionBar height?

I am trying to get the height of the ActionBar (using Sherlock) every time an activity is created (specially to handle configuration changes on rotation where the ActionBar height might change).

For this I use the method ActionBar.getHeight() which works only when the ActionBar is shown.

When the first activity is created for the first time, I can call getHeight() in the onCreateOptionsMenu callback. But this method is not called after.

So my question is when can I call getHeight() and be assured that it doesn’t return 0?
Or if it is not possible, how can I set the height of the ActionBar ?

21 Answers
21

Leave a Comment