I have been familiar with TabHost/TabSpec to create application with tabs. I noticed that there are more than one option to create tabs:
1- Tabs in action bar
2- Viewpager (I guess google calls it horizontal pager)
3- And offcourse the tabhost/tabspec approach.
I tried to read google docs but it is like everywhere so I got further confused.
When would you use what or is there one that is the norm?
Thanks
You should use a Toolbar with a ViewPager to simulate tabs (all wrapped in an AppBarLayout). The result will look something like this:
You can read more about this type of design on the Material Design spec: https://www.google.com/design/spec/components/tabs.html#tabs-usage
Also, here is a good tutorial on how to implement tabs within a ViewPager: http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/
Related
I am trying to make custom profile page , Tabbed layout is embed within ActionBar , and Tabs can change both with sliding and click on other tab.
I just started playing with ActionBar , and didn't understood what are major differences between Sherlock / simple ActionBar.
Here is what i am trying to make right now:
Any Help in any form appreciated , There is no similar Github lib or helper code at net/SO , so i can't figure out how i should get started
You will need to use a TabLayout along with a ViewPager. These are standard controls. Google it or see here for an example of how to use it. ActionBarSherlock isn't used anymore. Instead we use a Toolbar.
How would I go about implementing swipeable icon tabs as the main navigation in an app? Heres a screenie of the popular Flipboard app, which demonstrates what im looking for: http://prntscr.com/83607c
I have been looking for an answer to this question for almost a week now, and have asked on several communites yet no one seems to be able to answer how to go about doing something like this. I'm assuming its a ViewPager for the swipeable part, but the only thing I can think of for the tabs would be a TabLayout, but this implements tabs "below" the toolbar, eg: http://prntscr.com/83674c which is not what i'm looking for.
Google recently released Support Design library. Witch contains all the necessary views. You can read more here
The views you are interested:
TabLayout and
TabLayouts.Tab
Im trying to implement a tabbed navigation where the tabs are located inside the Toolbar and the user can navigate via left/right swipes or tab clicks, just like the Hotel Tonight app:
Screenie:
http://i.imgur.com/joXRr1N.png
Before this would be done using ActionBar.Tab, but that has been deprecated. All tutorials and SO questions i've found have only described how to use the new TabLayout to put tabs under the ToolBar, not inside it. How should I go about implementing this? What would the basic xml layout look like?
You can try using PagerSlidingTabStrip and here you are a tutorial:
https://guides.codepath.com/android/Sliding-Tabs-with-PagerSlidingTabStrip
I am trying to create app that has tabs which look like this one:
I know that it is possible to use fragments and tab indicators in actionbar but is this the best approach for this? I am using theme with noActionBar. I thought that I could use tabhost for this but I dont know if this is the best approach.
Thanks in forward
I've created a ViewPager. and I want to add scrollable tabs (swipey tabs) to make it more flexible (like google play).
and all the tutorials that i found using ActionBar.
How can i do it without using ActionBar?
PagerTabStrip and the tab flavor of ViewPagerIndicator should both give you swipey tabs.
This link will be helpful to you and you achieve that by following the example explained in the tutorial.
Or
You can search for SupportV4Demos in Samples and you can find the example FragmentTabs and Pager example to achieve that.