Android Actionbar Split And Position Items - android

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.

Related

Is it possible to customize items in split action bar?

I'm working with split action bar for my project, i would like to know is it possible to customize the items position in split action bar (i.e) i want some of the menu items in top of the action bar and some of them bottom of the action bar dynamically as my wish is it possible ?
Thanks in advance,
It is not possible to use normal actions on the top and split ActionBar at the same time. There is a trick you can use that is described below:
How to display both normal and split ActionBar?
But it is an old question and ActionBar is deprecated. You can now use multiple Toolbar objects instead of ActionBar. That way you can keep one of them at the bottom and add whatever actions you want to it.

Put android tabs in center of action bar

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.

Two menus in android

I want to have two menus in my android app. First one is search icon in ActionBar (at the top) and second is a TextView and pop up item at the bottom. How to achieve it? I tried android:uiOptions="splitActionBarWhenNarrow" but it moves all the menu items to bottom. Please help!
Android has not made this possible on purpose, the action bar at the bottom (called the split action bar) only has the purpose of giving extra room for actions if it is necessary (hence the uiOptions name "splitActionBarWhenNarrow").
You could still get the desired result by manually creating a split action bar by adding a LinearLayout at the bottom of your View, and using a PopupMenu for the menu.

How to have tabs at the bottom while using action bar sherlock?

I am working on an app where I am using ActionbarSherLock.
As per the requirements I want the Tabs at bottom,
but by default tabs appears at the top.
How I can set the tabs at the bottom...

android action bar with tabs below the screen

For my application , I'm planning to have a design as this:
http://img811.imageshack.us/img811/7045/problemel.png
-Design needs to have a title bar which is indeed the action bar in android. To overcome the compatibility issues, I used the sherlock action bar which is said to support older versions that dont have action bars. I havent tested yet for the older devices however.
-As far as I know, for navigation , we could rather use tabbed or dropdown list methods. I want to have constant tabs for every page in my app to stand below the page. This reflects the tabbed action bar, however I want it below not just under the action bar. I don't know how but youtube application somehow has it in the middle of the screen (if it's not a custom view). So how do we have tabs positioned in the bottom of the page?
-Also I want to have another menu, whose items depend on the page it's on. But the apperance will be the same for every page. In the picture on the left this menu has buttons as "Bt 1" ,"Bt 2". I dont want to repeat the same xml for every activity page, but I'm not sure how to achieve it without repeating. If the action bar allowed using both navigation tabs and the drop down list, I could put the items of this menu in the dropdown list just as the picture on the right (onto the gray button). But I guess it does not?!
Therefore I have to repeat the menu xml code in every page or is there another smart way?
Any advice will be appreciated.
This can be achieved not with tabs but by adding items to a linear_layout with a gravity of bottom but it is a bad practice as #D_Steve595 stated and should be avoided in android designs.
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);

Categories

Resources