【问题标题】:How to change the color of status bar in sdk version under kitkatkitkat下sdk版如何改变状态栏颜色
【发布时间】:2015-09-06 09:24:40
【问题描述】:

我想将状态栏的颜色作为工具栏的颜色。但我不知道如何在kitkat下的android sdk版本中做到这一点。 这是我的工具栏布局:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/material_light_blue"
    android:minHeight="?attr/actionBarSize"
    android:layout_gravity="center_horizontal">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageButton
            android:id="@+id/info_button"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="@null"
            android:src="@drawable/info"/>

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_vertical">

            <TextView
                android:id="@+id/toolbar_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="@dimen/text_title_size"
                android:textColor="@color/white"
                android:layout_gravity="center"
                android:text="@string/app_name" />

            <TextView
                android:id="@+id/toolbar_subtitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="@dimen/text_sub_title_size"
                android:textColor="@color/white"
                android:layout_gravity="center"/>
        </LinearLayout>
    </LinearLayout>
</android.support.v7.widget.Toolbar>

这是我的应用主题: @白颜色 @白颜色 @dimen/text_sub_title_size

非常感谢!

【问题讨论】:

    标签: java android toolbar statusbar


    【解决方案1】:

    你不能。就那么简单。 KitKat 是第一个支持在状态栏中显示任何类型透明度的版本。

    【讨论】:

    • 如果有,我会提到的。
    猜你喜欢
    • 2023-03-12
    • 2020-03-07
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 2016-10-04
    • 2021-11-05
    • 1970-01-01
    相关资源
    最近更新 更多