Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use dropdown AND tabs as navigation in the action bar?

Tags:

Is it possible to have both, an spinner/dropdown at the top and tabs just below in the action bar? I want to use the spinner at the top of the action bar as view-switch controller (i.e. table view or chart view) while the tabs below is going to show different lists of data.

The following screen shot illustrates exactly what I want to achieve:

enter image description here

If it's not possible having both modes in the action bar, I could put an TabWidget at the top of my content view. However, I'm little bit unsure if I should have one fragment or one activity per tab.

like image 786
Ismar Slomic Avatar asked Aug 01 '12 22:08

Ismar Slomic


People also ask

How do I toggle a drop down menu?

dropdown class indicates a dropdown menu. To open the dropdown menu, use a button or a link with a class of . dropdown-toggle and the data-toggle="dropdown" attribute.


1 Answers

EDIT:

Is it possible to use dropdown AND tabs as navigation in the action bar?

No. The code in ActionBarView (where the setNavigationMode(int) call ends up) uses a switch statement, so the modes can't be combined.

Some combination of the action bar navigation modes and my previous answer is still a valid option though: You could use a custom view in your Action Bar and use a ViewPager for the content. Each tab in the ViewPager would be a fragment that you can update manually (change the view type) from the parent activity when the spinner is changed.

Side note, there are 3rd party libraries such as ViewPagerExtensions that give the fixed tabs appearance without having to use the ActionBar tabs.

like image 162
roflharrison Avatar answered Oct 21 '22 07:10

roflharrison