如何使标签的ViewPager现在动作条选项卡去precated(棒棒堂) [英] How do I make tabs for a ViewPager now that ActionBar tabs are deprecated (Lollipop)

查看:154
本文介绍了如何使标签的ViewPager现在动作条选项卡去precated(棒棒堂)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了 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

推荐答案

看一看<一href="https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/SlidingTabLayout.java">SlidingTabLayout从谷歌I / O的Andr​​oid应用程序。这取决于<一href="https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/SlidingTabStrip.java">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(棒棒堂)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆