Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Implement Tabs in Toolbar?

So Im trying to implement a tab navigation with the tabs inside the Toolbar, just like in the Hotel Tonight app: https://play.google.com/store/apps/details?id=com.hoteltonight.android.prod&hl=en

Heres another pic kind of showing what im wanting to do:

http://36.media.tumblr.com/c3ffe56db07e02f865ca9059ec3ec0f2/tumblr_np5icmeHED1r2wjwko2_r1_250.png

Its basically just some icon tabs in the action bar, and you can swipe left/right to navigate through the tabs or click on them. I was looking at ActionBar.Tab but all of that seems to be deprecated now...so how should I go about implementing this?

EDIT: Heres a pic from the Hotel Tonight app showing the icon tabs in the Toolbar: http://40.media.tumblr.com/0f136bf03b655706c8bce495c4cf9cf3/tumblr_ns07c7vFhb1r2wjwko1_1280.png

2 Answers

Hi Orbyt,

There is a relatively new library from Google that makes it easier to add tabs to the Toolbar. There is a link here that talks about it:

(http://android-developers.blogspot.com/2015/05/android-design-support-library.html)

Thanks for the response. I know about the design library and TabLayout, but every guide and tutorial on implementing tabs ive seen has had them below the Toolbar, instead of inside it. Any tips or links on how to do something like that?

Still looking for this, have been asking on multiple communities but no one seems to have an answer, even though a good chunk of the top apps and apps with design awards are using this ui pattern. The Flipboard app (https://play.google.com/store/apps/details?id=flipboard.app&hl=en) also does this, heres a screenshot of it: http://prntscr.com/83607c