TheLettuceMaster
TheLettuceMaster

Reputation: 15734

Design on Android 4.0 (Tab layout)

I'm not sure what direction to take with a Tabbed layout.

I am targeting sdk 15, min sdk 11. Are tabs better left in the action bar or in the "body". I am not designing for tablets with this app (yet), but it seems tablets have tabs in the Action bar and smaller screens do not.

One of the main reasons why I ask is because Google does have some info on tabs here: http://developer.android.com/design/building-blocks/tabs.html

But I can't seem to find it in their new "Develop" section. So I don't know if this has been deprecated? There used to be a good example on Tab layouts.

Upvotes: 3

Views: 3943

Answers (3)

Alex Lockwood
Alex Lockwood

Reputation: 83303

Everything you find on the developer's site is recommended and is considered good practice. Further, the "design" and "develop" sections go hand in hand... the separation is not meant to imply that "only developers should look at 'develop'" or vice versa. You should treat each as equally important when writing your app.

So yes, it is recommended to implement your tabs with the action bar (as seen in FragmentTabs.java in the API Demos), and it is certainly not deprecated.

Upvotes: 0

Benito Bertoli
Benito Bertoli

Reputation: 25793

"If you use navigation tabs in your action bar, once the action items are separated on a narrow screen, the navigation tabs may be able to fit into the main action bar rather than be separated into the "stacked action bar." Specifically, if you've disabled the action bar icon and title (with setDisplayShowHomeEnabled(false) and setDisplayShowTitleEnabled(false)), then the navigation tabs collapse into the main action bar."

http://developer.android.com/guide/topics/ui/actionbar.html

This is in fact part of the new design pattern. If the tabs can fit into the main action bar, let them. Usually if you're in portrait mode they wouldn't (except for the case stated in the above quote), but when you switch to landscape mode (or if you're on a tablet) they would easily fit.

Upvotes: 0

DArkO
DArkO

Reputation: 16110

You can still use them. They are not deprecated. In the post android 3.0 versions the tabs have been placed in the action bar on tablets. on phones they are below the action bar in portrait and again in the action bar in landscape. it's is considered a good practice to follow those standards as android developer suggests. Now i haven't used the new implementations but rather a compatibility library called ActionBarSherlock. it is actually pretty good and its almost exactly the same in terms of usage as the regular tabs. you can find some good samples on how to implement what you need in there.

Also i am pretty sure you can find all the samples in your android sdk folder under samples/android-14 for example.

I always felt that its easier to browse through them from there as opposed to developer.android.

Hope this helps you.

Upvotes: 2

Related Questions