问题描述
我已经看到了 PagerTabStrip
是显示标签的 ViewPager
的方法。而现在,动作条
已pcated为工具栏
德$ P $,似乎 PagerTabStrip
是我唯一的选择。
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:
什么是现在这样做的正确方法?我应该手动使用旧 TabWidget
并添加标签?还是有造型的一种方式 PagerTabStrip
,我不知道?
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?
编辑:这是我结束了使用该库: https://github.com/neokree/MaterialTabs
Here's the library I ended up using: https://github.com/neokree/MaterialTabs
推荐答案
看一看SlidingTabLayout从谷歌I / O的Android应用程序。这取决于SlidingTabStrip.
您可以看到如何使用它做一个简单搜索:你把它添加到您的布局,然后只需用它连接你的 ViewPager
像这样:
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);
还有一个办法 setCustomTabView
自定义标签。
这篇关于如何使标签的ViewPager现在动作条选项卡去precated(棒棒堂)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!