This question already has an answer here:
How to display both normal and split ActionBar?
(1 answer)
Closed 9 years ago.
Just like the below image i want to show my icon
Click here
I want to split top and bottom action bar in both landscape and portrait mode of smartphone.
The below code is working only in portrait mode(top and bottom action bar show) but not in landscape mode bottom action bar options are showed in top action bar.
<application
android:uiOptions="splitActionBarWhenNarrow"
I just want to show both action bar in both landscape and portrait mode of smartphone like above image.
Thanks
Solution:
I have found the very nice solution for this problem, i think you will be also benefited using this solution
If you want both action bar will be separate then you should use Sherlock Action bar library. Using this library you can customize action bar as you like.
Here is the link
Thanks
You want the SplitActionBar, try this:
AndroidManifest.xml
<application
android:uiOptions="splitActionBarWhenNarrow"
http://developer.android.com/guide/topics/manifest/activity-element.html#uioptions
Add a bar at the bottom of the screen to display action items in the
ActionBar, when constrained for horizontal space (such as when in
portrait mode on a handset). Instead of a small number of action items
appearing in the action bar at the top of the screen, the action bar
is split into the top navigation section and the bottom bar for action
items. This ensures a reasonable amount of space is made available not
only for the action items, but also for navigation and title elements
at the top. Menu items are not split across the two bars; they always
appear together.
Related
I tried Android action bar with tabs. As you see in this picture:
(source: persiangig.com)
My action bar looks good in phones but in tablets it is not right, the tabs stick left. This picture shows what I mean, how can I put the tabs to center in tablets too?
(source: persiangig.com)
The tabs are aligned left because, in Android, the action bar is used for both navigation and Activity- or Fragment-specific actions. You don't have any in this screenshot, but menu actions that are added to the action bar will be aligned to the right.
If you must have your tabs centered for some reason, you'll have to write your own action bar. I would recommend against this, since it's a lot of work to intentionally go against user expectations. Instead, use Android's built-in action bar layout and design your app to accommodate it.
I've made an ActionBar with action ActionBarSherlock and I've spitted it with
android:uiOptions="splitActionBarWhenNarrow"
How can I position the items now? All my items are at the bottom ActionBar, I want some at the top and some at the bottom ...
As per the ActionBar guide:
Split action bar provides a separate bar at the bottom of the screen to display all action items when the activity is running on a narrow screen (such as a portrait-oriented handset).
If you want items on both the top ActionBar and buttons along the bottom, then you should use a regular ActionBar and add the buttons as a custom layout (perhaps using the android.R.attr.borderlessButtonStyle). However, you will not get the auto-collapsing into a single ActionBar on larger devices, but that can easily be done by creating a menu/layout specifically for wider devices using a selector like layout-w480dp on v14+ devices.
currently i am using ActionbarSherlock.
Right now, my apps has a Bar at top and a bar at the bottom with overflowed buttons.
I want a custom header bar and do not want to try to theme the Actionbar header bar, but I want to keep the bottom bar with the buttons.
Is it possible to hide the Header bar portion of the ActionBar?
ActionBar().hide() hides both top and bottom bars.
According to the action bar doc ("Using split action bar"): add uiOptions="splitActionBarWhenNarrow" to the corresponding manifest element. Then use setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false). The tabs move are moved into the - now empty - top bar.
I would like to override (add more buttons that would take me to several activities/fragments) to the system Navigation Bar on a tablet (according to this android ui-overview it is a "Combined bar" (for tablets)
Is there a way to do this?
I couldn't find a Navigation class in the android.app package, like ActionBar.
If adding buttons to the combined/navigation bar is not possible, I think there are several options, but I'd like to explore this first:
- use the action bar on top instead
- add a bottom bar above the navigation bar (not really fine, since it would be on top of the combined bar), like they are showing here:
Action Bar
Thanks a lot,
Cristian
Is there a way to do this?
No. The only thing you can add to the system bar are Notifications, which are not meant for this sort of navigation.
If adding buttons to the combined/navigation bar is not possible, I think there are several options, but I'd like to explore this first: - use the action bar on top instead - add a bottom bar above the navigation bar (not really fine, since it would be on top of the combined bar), like they are showing here: Action Bar
If you are referring to the section titled "Layout Considerations for Split Action Bars", that is referred to as a "split action bar", and can be enabled on an <activity> via android:uiOptions="splitActionBarWhenNarrow". However, that will only take effect for -small/-normal screens in portrait orientation. Your buttons will automatically be placed in the action bar at the top of the screen in other circumstances.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Find out if ActionBar is stacked
Is there any qualifier or method how to detect, if stacked action bar is used? Or do you know the rules, when the stacked action bar is used (e.g. specific screen size)?
Stacked action bar is described on figures 9 and 10:
http://developer.android.com/guide/topics/ui/actionbar.html#Tabs
There isn't a specific method (e.g ActionBar.isStacked()), but you can make a reasonable guess based on some simple rules. Stacked bars are added on narrow devices (in practice this is typically phones in portrait mode). The menu items, icon and Title go on the top bar, and tabs go on the stacked bar. As it mentions in the guide you linked, if you remove the menu items, icon, and title, the top bar will disappear, leaving only the stacked bar. So if you want only one bar, that would be one workable strategy.
All that said, if you're just trying to use the overlay mode of the ActionBar and need to know how far down to put your content so that the bar doesn't hide it, getHeight() will return the height for the full bar (so both bars if stacked is in effect).