一.statysBar颜色设置方法

方法一:

在styles.xml里设置"colorPrimaryDark"的值:
<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimaryDark">@color/mainColor</item>    </style></resources>

方法二:

在styles.xml里设置"statusBarColor"的值:
<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="android:statusBarColor">@android:color/black</item>    </style></resources>

二.colorPrimaryDark和statusBarColor

不同点:

-1.statusBarColor具有更高的优先级,两个同时出现,statusBarColor会覆盖colorPrimaryDark。

-2.statusBarColor在Android5.0以下的版本中会出现警告。

-3.默认情况下,statusBarColor的值继承自colorPrimaryDark。

更多相关文章

  1. [置顶] Android(安卓)ButterKnife
  2. android webview 介绍
  3. android 快速开发(三)巧用公共标题栏:避免每次activity都得写标题栏
  4. Android中间层c语言log打印方法
  5. Android设置程序最小运行的堆内存
  6. Android(安卓)studio从菜鸟到高手--第一季
  7. android UI进阶之自定义组合控件
  8. android NumberPicker 全面解析
  9. Android使用HttpURLConnection进行POST请求,向服务器上传数据

随机推荐

  1. 安卓入门.RelativeLayout相对布局2
  2. Android(安卓)C++的sp指针简介
  3. android 图片轮播框架banner
  4. ContentProvider共享数据和ContentResolv
  5. ZZ android am命令
  6. android fragment 使用name关联Fragment
  7. android屏幕的那些事之一!
  8. android跳转到手机系统默认应用市场的方
  9. Android(安卓)  Fragmnet的使用新体会
  10. android 常见死机问题--log分析