Reputation: 1835
How is it possible to show second action bar on a bottom of display? I want to be able to hide bottom bar from code according to needs when application is running.
I want to have there action buttons shown always, not only when there is no space on the top (I have top actionbar hidden, only tabs are there). Top and bottom bar should be independent.
Bottom bar si in the picture there: http://goo.gl/pFvHI
Thank you.
Upvotes: 1
Views: 4672
Reputation: 18243
Use in your AndroidManifest:
<activity
android:name=".MyActivity"
android:uiOptions="splitActionBarWhenNarrow"
android:label="@string/app_name" />
Key here is uiOptions="splitActionBarWhenNarrow"
.
Upvotes: 1
Reputation: 1986
As per se it is not possible to split the action bar,as android handles it as a case per case basis based on screen dimensions. Take a look here: Have the split action bar..
Most of the apps that have that behaviour have custom made views that show on screen.You could create a LinearLayout that has a method to add buttons and hide or show the view,and simply having a click listener on those views.Even google did this way on some of their apps.
Upvotes: 2
Reputation: 22493
Yes, it's possible Create Options Menu
by using SHOW_AS_ACTION_IF_ROOM
for menu items.
like this
@Override
public boolean onCreateOptionsMenu(Menu menu) {
int actionRoom = MenuItem.SHOW_AS_ACTION_IF_ROOM;
menu.add(Menu.NONE, ACCOUNTS_MENU, Menu.NONE, "Search")
.setIcon(R.drawable.ic_menu_account_list)
.setAlphabeticShortcut('a')
.setShowAsAction( accountRoom );
}
Upvotes: 1