Android 5.0 Material 风格的标签

标签 android android-tabs material-design

Android 5.0 框架是否有 Material 风格的标签?我知道在开发预览中,它们仍然是 Holo 风格的。我想知道 5.0 是否更新了 Material 样式的选项卡;我目前使用PagerSlidingTabStrip对于我的标签,但尚未使用 Material Design 进行更新。

更具体地说,支持库是否包含 Material 选项卡的实现?在 4.x 上运行的 Play 商店有这些标签,但我不确定这是否是 Google 的自定义实现。

最佳答案

更新(2015 年 10 月 19 日):

现在由 Android 设计支持库提供:

编译“com.android.support:design:23.1.0”

Chris Banes 示例:

https://github.com/chrisbanes/cheesesquare

Android 开发者博客:

http://android-developers.blogspot.com/2015/05/android-design-support-library.html

Android 文档:

http://developer.android.com/reference/android/support/design/widget/TabLayout.html?utm_campaign=io15&utm_source=dac&utm_medium=blog

支持库:

https://developer.android.com/tools/support-library/features.html#design

原答案:

查看最新版本的 Google Play(下方)。

他们正在使用 SlidingTabsColors (不是 SlidingTabsBasic)但有颜色。您需要查看这两个文件:SlidingTabLayout.javaSlidingTabStrip.java并且只需更改颜色以匹配您的 ActionBar/TooBar 颜色。

此外,您会注意到,当您向左/向右滑动时,Tab 标题文本颜色将变为“白色”,而未选中的标题为“灰色”。

例如(如何更改指示器颜色):

class SlidingTabStrip extends LinearLayout {
    // change the strip color
    private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5;
   ...
}

请在此处查看示例:https://developer.android.com/samples/SlidingTabsColors/index.html

Google Play Store

请同时阅读:

Android - Google Play like tabs

Action bar navigation modes are deprecated in Android L

关于Android 5.0 Material 风格的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26442941/

相关文章:

android - float 操作按钮阻挡其他组件

android - 如何在 RecyclerView 中使用拖动手势进行多选?

android - 在 fragment 中添加 Google Maps API V2

android - 如何在 Android Studio 中创建自定义键盘快捷键

Android Swipe Tab Action Bar - 使选项卡中的更改持久化

android - 替代 FragmentPagerAdapter

android - 带椭圆选框的 CollapsingToolbarLayout 标题

java - 安卓应用程序。类未找到异常

android - 如何使用 sharedview 模型 koin android 注入(inject)具有作用域的 View 模型

android - 如何为可滑动标签添加图标