上文 ,对Android 5.X特性,主要是Material Design的特性进行了介绍,这篇文章我们来使用Material Design主题。

  Material Design 现在有三种默认的主题可以设置,相应源代码如下所示:

@android:style/Theme.Material (dark version)@android:style/Theme.Material.Light (light version)@android:style/Theme.Material.Light.DarkActionBar

  效果图如下所示:

  在Android5.x中引入了colour Palette的概念,Color Palette让app的开发者自己设定系统区域颜色,从而使整个app的颜色与系统区域的颜色来保持相互的统一。

  

    <style name="AppBaseTheme" parent="android:Theme.Material">        <!--            Theme customizations available in newer API levels can go in            res/values-vXX/styles.xml, while customizations related to            backward-compatibility can go here.        -->    </style>    <!-- Application theme. -->    <style name="AppTheme" parent="AppBaseTheme">        <!-- All customizations that are NOT specific to a particular API-level can go here. -->        <item name="android:colorPrimary">#bebebe</item>        <item name="android:colorPrimaryDark">#FF5AEBFF</item>        <!-- theme UI controls like checkboxes and text fields -->        <item name="android:navigationBarColor">#FFFF4130</item>    </style>

  譬如,使用上述xml代码,用户就能够自定义自己的Style 来创建自己的Palette,从而实现不同的颜色风格。效果图如下所示:

更多相关文章

  1. [APP] Android(安卓)开发笔记 006-使用短信验证SDK进行短信验证
  2. android listview custom style 自定义样式
  3. Android(安卓)设置EditText光标Curso颜色及粗细
  4. android 中使用TextView实现分段显示不同颜色的字符串
  5. Android读取Excel文件
  6. 【android开发】styles.xml常用的设置属性汇总
  7. Android(安卓)Manifest文件中meta-data的配置读取
  8. Android(安卓)tabhost让选中项加上背景图
  9. android与.NET webservice

随机推荐

  1. Android(安卓)map
  2. Android(安卓)UI(1)Getting Started - Fi
  3. Android(安卓)UI 优化-使用theme 预加载
  4. android 让一个控件按钮居于底部的几种方
  5. 系出名门 Android(安卓)系列文章索引
  6. Android(安卓)UI之EditText注意点收集
  7. Android(安卓)TextView行间距解析
  8. Android学习笔记---第一天---布局
  9. Android各种资源引用的方法
  10. android:windowSoftInputMode属性使用