【问题标题】:Change the style of status bar elements in android更改android中状态栏元素的样式
【发布时间】:2016-08-29 12:44:35
【问题描述】:

如何在 android 中更改状态栏元素的样式(材料设计)。我想做这样的事情...我想改变时间和电池的颜色,而不仅仅是状态栏的背景

【问题讨论】:

标签: java android android-layout android-studio material-design


【解决方案1】:

只需将其添加到您的styles.xml 中。 colorPrimary 用于操作栏,colorPrimaryDark 用于状态栏。

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:colorPrimary">@color/primary</item>
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
</style>

来自开发者 android 的这张图片解释了有关调色板的更多信息。你可以阅读更多关于link的内容。

【讨论】:

    【解决方案2】:

    在 AndroidMainFest 中

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
    

    在值/style.xml 中

    <style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:windowEnableSplitTouch">false</item>
        <item name="android:splitMotionEvents">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@color/color_bg_splash</item>
    </style>
    

    【讨论】:

      猜你喜欢
      • 2017-12-13
      • 1970-01-01
      • 2016-01-11
      • 1970-01-01
      • 2016-09-10
      • 1970-01-01
      • 2016-08-24
      相关资源
      最近更新 更多