问题
I want to create the following layout - an activity with a viewpager along with a tab that stays that the bottom of the activity to indicate which of the 4 fragments the user is in (and the selected tab gets highlighted by an 'active colour')
I've spent some time looking at various resources online to add this tab.
http://developer.android.com/training/implementing-navigation/lateral.html#tabs - this looked like it would work well until I found out that actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
is deprecated
I looked here however, it is the same solution (i.e. deprecated)
I looked here however, the PagerTitleStrip shows one tab (and partly the adjacent tabs) while I want to see all the tabs (there are no partially hidden tabs as in the picture)
Is there a tutorial that explains how to achieve this? It is one of the most basic UI elements, so I am hoping I am not finding the best solution
回答1:
I was looking for same and I saw this question, here in this answer OP says that
it's against Android Design Guideline since at bottom there are soft/hard buttons like back button home button etc.
http://developer.android.com/design/patterns/pure-android.html
But if you insist on to put them at the bottom, you can implement it like GitHub example consists tabs in bottom, using FragmentTabHost.
https://github.com/rameshkec85/BottomTabsFragmentTabHost
So even I am considering it.
来源:https://stackoverflow.com/questions/27581447/viewpager-in-android-with-fixed-tabs-at-bottom-with-icon-and-text-in-each-tab