Android 5.0 Material 风格的标签页 [英] Android 5.0 Material-styled tabs

查看:22
本文介绍了Android 5.0 Material 风格的标签页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android 5.0 框架有 Material 风格的标签页吗?我知道在开发预览中,它们仍然是 Holo 风格的.我想知道 5.0 是否更新了材质样式的选项卡;我目前使用

Android L 中不推荐使用操作栏导航模式

Does the Android 5.0 framework have Material-styled tabs? I know in the dev preview, they were still Holo-styled. I was wondering if 5.0 has been updated with material-style tabs; I currently use PagerSlidingTabStrip for my tabs, but that has not been updated with Material design yet.

More specifically, does the support library include an implementation of material tabs? The Play Store running on 4.x has those tabs, but I'm not sure if that's a custom implementation by Google or not.

解决方案

Updated (10/19/2015):

This is now provided by the Android Design Support Library:

compile "com.android.support:design:23.1.0"

Chris Banes example:

https://github.com/chrisbanes/cheesesquare

Android Developer Blog:

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

Android Docs:

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

Support Library:

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

Original Answer:

Look at the latest version of Google Play(down below).

They are using the SlidingTabsColors(not SlidingTabsBasic) but with colors. You need to look at those two files: SlidingTabLayout.java and SlidingTabStrip.java and simply change the color to match your ActionBar/TooBar color.

Also, you will notice when you swipe left/right, the Tab title text color will become "white" and the unselected titles are an "gray" color.

For example(how to change the indicator color):

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

Please see the example here: https://developer.android.com/samples/SlidingTabsColors/index.html

Please read these as well:

Android - Google Play like tabs

Action bar navigation modes are deprecated in Android L

这篇关于Android 5.0 Material 风格的标签页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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