问题描述
我想要一个这样的标签示例
I want an example of tab like this
我搜索了,但刚刚得到这个.
I searched but just got this.
我无法使用此来源.谁能告诉我另一个带有滑动选项的标签示例.
我认为 viewpageindicator 与谷歌播放标签不同.
因为当我在谷歌播放页面滚动时,标签下方的行在滚动时移动,但在 viewpageindicator 中它不是.
谢谢
I couldn't use this source. Can someone tell me another example of tab with sliding option.
I think the viewpageindicator is not the same as google plays tabs.
cause when i'm scrolling in google plays page the line below tabs moves while scrolling, But in viewpageindicator it's not.
Thank you
推荐答案
首先需要用viewpager创建一个xml布局文件android.support.v4.view.ViewPager
First you need to create an xml layout file with viewpager android.support.v4.view.ViewPager
然后在你的主要活动中膨胀这个布局,确保你的活动实现
Then inflate this layout in your main activity, make sure your activity implements
android.support.v7.app.ActionBar.TabListener
假设你想要 4 个标签,然后创建
android.support.v7.app.ActionBar.TabListener
Lets say, you want to have 4 tabs, then create
4 个不同的片段.
您选择的标签.
这是带有代码片段的简单示例,http://www.feelzdroid.com/2014/10/android-action-bar-tabs-swipe-views.html
Here is the simple example with code snippet, http://www.feelzdroid.com/2014/10/android-action-bar-tabs-swipe-views.html
注意:上面的例子适用于android support lib,它提供了backward actionbar
Note: above example works well with android support lib, which provides backward actionbar
兼容早期版本的安卓手机
compatibility for earlier version of android phones
希望对您有所帮助.
谢谢
这篇关于如何使用页面滑动视图创建 Android 选项卡式样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!