I'd like to have an app layout as the one they used for Gmail. They have the actionbar that has icons (on my device it has the app logo for up navigation, and a custom view for selecting priority inbox/inbox/etc), but there is also some kind of split ActionBar
because at the bottom I have several icons (compose, search, labels, etc).
How could I do this? I have implemented the following ActionBar
through this XML:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_gps"
android:icon="@drawable/icone_gps_continu"
android:showAsAction="always"
android:title="@string/menu_gps"/>
<item
android:id="@+id/menu_sort"
android:icon="@drawable/icone_liste_chron"
android:showAsAction="always"
android:title="@string/menu_liste"/>
<item
android:id="@+id/menu_stats"
android:icon="@drawable/icone_statistiques"
android:showAsAction="always"
android:title="@string/menu_stats"/>
<item
android:id="@+id/menu_save"
android:icon="@drawable/icone_terminersortie"
android:showAsAction="always"
android:title="@string/menu_save"/>
<item
android:id="@+id/menu_search"
android:icon="@drawable/ic_launcher"
android:showAsAction="always"
android:title="@string/menu_search"/>
<item
android:id="@+id/menu_photo"
android:icon="@drawable/icone_enregistrerphoto"
android:showAsAction="always"
android:title="@string/menu_photo">
</item>
<item
android:id="@+id/menu_sound"
android:icon="@drawable/icone_enregistrerson"
android:showAsAction="always"
android:title="@string/menu_sound">
</item>
<item
android:id="@+id/menu_settings"
android:icon="@drawable/icone_parametres"
android:showAsAction="always"
android:title="@string/menu_settings">
</item>
</menu>
And I have of course enabled the split ActionBar
by adding android:uiOptions="splitActionBarWhenNarrow"
to my <application>
tag in the manifest.
What I get though is an empty "top" ActionBar
; and the bottom one is displaying only three icons. I thought I could display like 3-4 icons at the top and 5 at the bottom in portait mode, and all of them at the top in landscape mode.
Note: even if I'm testing on ICS with my Galaxy Nexus, I'm using ActionBarSherlock in order to provide backward compatibility.
In Android applications, ActionBar is the element present at the top of the activity screen. It is a salient feature of a mobile application that has a consistent presence over all its activities. It provides a visual structure to the app and contains some of the frequently used elements for the users.
Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button. In general an ActionBar consists of the following four components: App Icon: App branding logo or icon will be displayed here.
The key functions of the app bar are as follows: A dedicated space for giving your app an identity and indicating the user's location in the app. Access to important actions in a predictable way, such as search. Support for navigation and view switching (with tabs or drop-down lists).
Looks like I posted too fast, it seems it's not possible.
Duplicates:
Apparently this is not possible. However they did it in gmail/gplus, maybe using a custom view for the bottom part... Still expecting a better answer to this!
Reto Meier's word on this:
I think the problem with splitting the actions between the top and bottom is that it would make it more difficult to perform actions. Actions should be the most important things to do on an Activity -- splitting them between the top and bottom of the screen means users need to look in two places rather than one.
I was also wondering how these apps had icons in both bars, so I decompiled two of them.
What I found is that these two apps didn't implement the ActionBar
at all and use custom layouts for both bars. I'm not sure if I can name these apps here, but they are well known apps with 10M+ downloads.
I strongly suggest to go the same way if you don't like the default ActionBar
(which have very little room for customization) and create custom layouts instead (not necessary for both bars, it depends on your needs).
It's quite easy to reproduce the split action bar layout. Its height is always 48dp
whatever the device is, so a simple LinearLayout
or RelativeLayout
with a fixed height and some transparent image buttons work very vell. In only 15 minutes you get a fully customizable split action bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With