I have implemented a split actionbar as per android documentation, by adding the following line inside the Application tag of my AndroidManifest.xml: android:uiOptions="splitActionBarWhenNarrow". This has worked, the buttons that appear on the bottom action bar appear in a different fashion to various examples I have seen across the internet and I do not know why.
I have seen many examples on the internet appear like this:
However, the buttons on my bottom action bar appears like this:
How can I space them out so they have the same layout as the first example?
If it renders like this, it's because your screen is larger than the examples you've seen. On your device, I guess the buttons would be too large if they filled all the space.
If you try with 5 buttons, they may suddenly fill all the space available. It really depends on the screen width.
Anyway, developers have almost no control over the layout of the split action bar. That's why several popular apps don't use the split action bar at all but use a custom layout instead (since this bar isn't really hard to reproduce).
Related
I am developing an application that must hide title bar to increase screen spaces and for design issues. on non-physical buttons devices like nexus-4 and for Android > 3.0, I can't switch to use Action bar because the title bar is hidden, and in the same times these devices hasn't physical buttons to use standard menu.
My Question: How can I solve this problem
Thanks
How can I solve this problem
Modify your UI to either:
Add back the action bar, or
Add something else on your screen, such as a button, to display something else on the screen that will serve as your "menu". You can see this approach used by many games.
This is a picture of my phone (Android 2.1 with HKC Sense):
The bit that's got a red border around it is in the Clock app and the Media player on my phone. What is it called? Is it a standard Android interface control?
I've been trying to figure out how to get something like this for the past while and I'm not seeing anything immediately obvious.
I've seen a lot of people referring to the ActionBar or Split ActionBar, but that seems to be something that is anchored to the top. I need this to be at the bottom without any component on the top.
*please excuse
It's an actual pic of the phone, rather than a screenshot - the screenshot app I downloaded wouldn't work.
The fact that the pic was taken with an iPhone, and that the apple logo is clearly reflected in the pic.
You can use Split ActionBar
android:uiOptions="splitActionBarWhenNarrow"
And that will force the action bar items to be hosted on the bottom of the screen for narrow devices, mostly phones. When this flag is set, no components are hosted on the top of the ActionBar, unless you use tab navigation.
See example Image
Keep in mind though, that should you be displaying the layout on a non-narrow device, like a tablet, then the items will be attached to the top ActionBar.
Some other things to consider
Creating a custom view, which you can set to the bottom of the layout. The View would be a scrollable ListView per say, and you can add as many icons as you'd like to it. Here's an example. That would not be a standard nav pattern though.
I am developing a simple four-action app for Android 3.2. I want all the menu items to appear in the action menu on a single line. (At the moment they appear as a 2x2 grid. I want a 1x4 grid.)
To achieve this I would like to:
remove the text and display only the icon
I have tried removing the android:title attribute, but the empty space for the text remains
minimise the width of the items, so that they all fit in one row (this may not apply to literally all screen sizes, but in my case I can see that the icon images could fit on my emulator screen)
How can I achieve this?
this is just a guess , but it seems like a thing that android won't support out of the box , since there are many different screens out there , and some won't have enough space for all your buttons (you have 4 , but imagine someone who wishes 10 instead) and google won't like it that the user will be frustrated when trying to click the tiny action buttons.
if you want, you can always create your own customized action bar , which would have any behavior you wish .
I want to display the Action Bar Vertically in my App.
I have found few examples for the Horizontal One, but not any for the Vertical One.
Can anyone please give me any example for the Vertical Action Bar.
Thanks,
David Brown
There's nothing in the Android UI design guide about a vertical ActionBar. But you might be able to coerce a similar effect by locking the display orientation, and then applying a rotation to the View in the content area. You also might be able to get somewhere by downloading the source code for ActionBarSherlock and implementing your own version of the ActionBar. But I don't recommend either of these solutions. If you're really that intent on putting actions on the side of your screen, I suggest either a small vertical LinearLayout, or implement one of the side navigation solutions as discussed in Android Facebook style slide.
I've asked a similar question about the Android ActionBar before: Change ActionBar Tabs background color
I still don't have an answer to the question: when will the two line design/when the one line design used? I've set a custom divider to my tab bar and it's also being used in the horizontal layout. However to create drawables/styles based on the orientation/screen size etc I need to know when which layout is being used. Looking through the Android source it seems they are using the same drawables for both layouts, so that doesn't really help me. The same problem applies when changing the font color of the Tab View.
I fear that it'll be decided in code which format is being used, so there's not really any way around this. Can anyone confirm this? Or is there at least a way to find out in code if the Action bar is one lined or two lined?
Android will stack tabs beneath the action bar when it deems the screen size/orientation to be narrow (like on a normal sized screen in portrait, or on a small sized screen regardless of orientation). Similarly if there are many tabs, in some cases they will appear as a drop-down list in order to ensure the best fit in the action bar.
The Action bar is a highly adaptive UI control. If you are going to use its navigation modes I would strongly suggest not trying to anticipate their configuration or attempt to apply styles that are specific to each one. Your tab drawables will always need to be 9patch anyway because the base action bar height will also vary across orientations and screen sizes (notice its height is slightly smaller in landscape).
That said, you can query the action bar height at runtime using its getHeight() method. This Honeycomb Gallery example included in the SDK uses a bunch of logic in an OnGlobalLayoutListener to ensure that the Fragment layout responds to the various action bar sizes appropriately.