Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make tabs for a ViewPager now that ActionBar tabs are deprecated (Lollipop) [duplicate]

I've seen that PagerTabStrip is a method of displaying tabs for a ViewPager. And now that ActionBar has been deprecated for Toolbar, it seems that the PagerTabStrip is my only option.

Except, I only see it comes out in the following style: enter image description here

I really just want normal tabs (with icons) the way I could do it with the ActionBar before like this:

enter image description here

What is the proper way of doing this now? Should I use an old TabWidget and add tabs manually? Or is there a way of styling the PagerTabStrip that I didn't know about?

EDIT: Here's the library I ended up using: https://github.com/neokree/MaterialTabs

like image 434
Keith Avatar asked Oct 23 '14 16:10

Keith


1 Answers

Have a look at SlidingTabLayout from Google I/O Android App. It depends on SlidingTabStrip.

You can see how it's used by doing a simple search: you add it to your layout and then just connect it with your ViewPager like so:

slidingTabLayout.setViewPager(viewPager);

There is a way to setCustomTabView to customize the tabs.

like image 99
Egor Neliuba Avatar answered Oct 19 '22 12:10

Egor Neliuba