1

I want to add split actionbar to my existing actionbar that gets displayed at the top of the screen, so that I can display those tabs at the bottom

ActionBar ab;
ab = getSupportActionBar();
ab.setDisplayShowHomeEnabled(false);
ab.setDisplayShowTitleEnabled(false);
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);


Tab tab = ab
        .newTab()
        .setIcon(R.drawable.ic_ab_dialpad)
        //.setText("DialPad")
        .setTabListener(new MyTabListener<DialerFragment>(this, "DialPad",
                DialerFragment.class));
ab.addTab(tab);

tab = ab
        .newTab()
        .setIcon(R.drawable.ic_ab_history_holo_dark)
        //.setText("Recents")
        .setTabListener(new MyTabListener<CallLogListFragment>(this, "Recents",
                CallLogListFragment.class));
ab.addTab(tab);

/*tab = ab
        .newTab()
        .setIcon(R.drawable.ic_contacts)
        //.setText("Contacts")
        .setTabListener(new MyTabListener<ContactListFragment>(this, "Contacts",
                ContactListFragment.class));
ab.addTab(tab);*/

/*tab = ab
        .newTab()
        .setIcon(R.drawable.ic_services)
        //.setText("Services")
        .setTabListener(new MyTabListener<ServicesFragment>(this, "Services",
                ServicesFragment.class));
ab.addTab(tab);*/

tab = ab
        .newTab()
        .setIcon(R.drawable.ic_voicemail)
        //.setText("Settings")
        .setTabListener(new MyTabListener<VoiceMailFragment>(this, "Settings",
                VoiceMailFragment.class));
ab.addTab(tab);

At present, these tabs are at the top. how do i make this into a split actionbar? I want to display these main tabs at the bottom and two other tabs at the top

ksugiarto
  • 940
  • 1
  • 17
  • 40
Arnav
  • 11
  • 2

1 Answers1

0

Add

uiOptions="splitActionBarWhenNarrow" 

inside your activity tag where you want to split actionbar if API version is 14 or higher

otherwise add

<meta-data android:name="android.support.UI_OPTIONS"
                   android:value="splitActionBarWhenNarrow" /> 

inside <activity> and </activity> if API version is lower than 14.

for example:

   <manifest ...>
    <activity uiOptions="splitActionBarWhenNarrow" ... >
        <meta-data android:name="android.support.UI_OPTIONS"
                   android:value="splitActionBarWhenNarrow" />
    </activity>
</manifest>

And here is the guide on how to split actionbar.

Karan Nagpal
  • 521
  • 1
  • 8
  • 19
  • Hi karan. Thanks for the information. Can you tell me how to mention which tabs to include at the top and which at the bottom? Getting really confused here. I mean where do I specify this? – Arnav Oct 26 '13 at 10:33
  • With split ActionBar you can only display action items at the bottom, not tabs. – Karan Nagpal Oct 26 '13 at 18:11
  • Okay. Is there any other way to display tabs at bottom ? – Arnav Oct 27 '13 at 12:34
  • [Check this post](http://stackoverflow.com/questions/2395661/android-tabs-at-the-bottom) – Karan Nagpal Oct 28 '13 at 05:19