If you add tabs to your ActionBar
, they will be in an extra stacked ActionBar
on phones in portrait mode. Is there an easy way to find out whether
It is possible to find out if there is one or two lines in action bar by is's height. There is method getHeight(), but it will not work in onCreate
or onStart
, it will return real value only if activity already started.
In landscape orientation height of action bar is 40dip
(80/60/40/30 px on different screens), in portrait orientation with tabs it is 96dp (192/144/96/72 px).
It is not the best idea to rely on this, but I can't find any other way to find out if tabs is inside action bar.
This behavior is called Split Action Bar. It happens when the AndroidManifest
is set with uiOptions="splitActionBarWhenNarrow"
in the <activity>
or <application>
element.
Android adjusts the action bar's appearance in a variety of ways, based on the current screen size. Using split action bar is just one option that you can enable to allow the action bar to further optimize the user experience for different screen sizes. In doing so, you may also allow the action bar to collapse navigation tabs into the main action bar. That is, if you use navigation tabs in your action bar, once the action items are separated on a narrow screen, the navigation tabs may be able to fit into the main action bar rather than be separated into the "stacked action bar".
You can get more details here.
well i have created an actionBar similar to Instagram with a bottom ActionBar without the need of using Tabs. have a look at this image . i'v answered this related question on another question 10 minutes ago.
in order for you to do this you have to create three separate layouts. one for the bottom to use it as Include
and one for the ActionBar To use it As ActionBar View.
if you check my latest answers you'll find how i did this. hope that benefits you in anyway. cheers