问题
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:
I really just want normal tabs (with icons) the way I could do it with the ActionBar before like this:
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
回答1:
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.
来源:https://stackoverflow.com/questions/26532415/how-do-i-make-tabs-for-a-viewpager-now-that-actionbar-tabs-are-deprecated-lolli