I want to display Tabs below Android Action Bar in Landscape mode
I have set
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
I tried android:uiOptions="splitActionBarWhenNarrow" in Android manifest but everything seems to be OK in Portrait. But when view changes to Landscape, the tabs get embedded inside action bar.
Anyone has implemented this, because this does not seem to work.
OS - ICS and above.
This is correct behaviour. It's Split-Action-Bar-When-Narrow option and there are no options how to determine which actions will be displayed at top and which at bottom. ActionBar element is doing this according to screen orientation and screen resolution. Use your own toolbar.
Related
Description & Problem:
I'm using ActionBarSherlock i found that they are a bug in ABS, so my issue that i need to put tab bar at top bar (one line, like shown on the screenshot) already tried this solution but without effect.
I note that i don't have this problem on tablet. The problem is on 5.4° devcie Note III.
This is the normal behavior. On Large screen (tablet) or on landscape phone screen, Tab bar is included to top bar, and on small screen Tab bar is below top bar.
Try to add a SlidingTabLayout as a custom ActionBar view
I am unsure what to search for this so all links are appreciated.
When I change the orientation of my device to portrait mode all the tabs are going below the action bar, not on it, even though there is plenty of room (I am using 2 tabs while testing on a Nexus 10). Will the tabs always appear below the action bar in portrait mode or is there a way around this?
What I want to happen:
(source: android.com)
What is happening: NOTE: this is the behavior I am getting even when there is PLENTY of room to display the tabs in the action bar:
(source: android.com)
Thanks in advance!
Will the tabs always appear below the action bar in portrait mode
On small/normal screens, yes. Action bar tabs will go where the action bar implementation wants to put them... which includes them not being tabs at all in some cases, but a drop-down list instead.
We are building an Android 4.0 app with tabbed navigation at the top. This all works great in portrait mode but when the application changes to landscape mode (which we want to support), the default behaviour is for the tabs to move up into the top/action bar which seems to eliminate the ability to have a screen title shown and seems crowded with the actions that appear on the right of the top/action bar.
What is the best approach to prevent this and how difficult would it be to override this default behaviour?
I am using a action bar. I have menu items on that. I have set the property on it as
android:showAsAction="ifRoom|withText"
So it's working in Potrait and landscape really well. On one page I have Tabs, it's not recognizing tabs and overwriting the tabs. What I would like to do is, in Potarit just show tabs and all menu in drop down. In Landscape show tabs and as many menu items possible on action bar.
Thanks,
Have a res/menu/options.xml and a res/values-land/options.xml to distinguish the cases. Or, if the rule really is not portrait vs. landscape but a minimum screen width, use res/menu/options.xml and res/menu-wNNNdp/options.xml, where NNN is the minimum width in dp for when you want to use some other approach for your menu.
I have a number of tabs on the ActionBar and I want to find a way to handle those when the tablet is put into portrait mode. Currently, if you have more than 3-4 and any showing menu items, any more tabs will be cut off and unavailable. I'm wondering if there's a way to have those overflow into a "more" tab automatically. Or, if there's a way to have physical tabs and a drop down list for extra options as the last "tab". Has anyone encountered this scenario yet?
I would do one of the following if I were developing the app that required a use case with a high count of tabs:
Override onConfigurationChanged to detect when in portrait mode and hide the text on the tabs leaving only the icon. Using themes you can also adjust the padding of the tab contents.
Override onConfigurationChanged to detect when in portrait mode and switch the navigation be list-based. This will provide you with more room for action items while still showing the current "tab" that the user is on.
Implement a custom navigation view which responds to portrait in whatever manner you would like (e.g., scrolling horizontally, presenting only the selected tab with text, showing only the selected tab with an overflow-style button for the additional ones).
From http://developer.android.com/sdk/android-4.0.html#ActionBar
The ActionBar has been updated to support several new behaviors. Most importantly, the system gracefully manages the action bar’s size and configuration when running on smaller screens in order to provide an optimal user experience on all screen sizes. For example, when the screen is narrow (such as when a handset is in portrait orientation), the action bar’s navigation tabs appear in a “stacked bar," which appears directly below the main action bar.
Yay!