Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在kitkat下更改sdk版本中状态栏的颜色_Java_Android_Toolbar_Statusbar - Fatal编程技术网

Java 如何在kitkat下更改sdk版本中状态栏的颜色

Java 如何在kitkat下更改sdk版本中状态栏的颜色,java,android,toolbar,statusbar,Java,Android,Toolbar,Statusbar,我想使状态栏的颜色作为工具栏的颜色。但我不知道如何在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="ma

我想使状态栏的颜色作为工具栏的颜色。但我不知道如何在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>
这是我的应用程序主题: @颜色/白色 @颜色/白色 @尺寸/文字\u子标题\u尺寸


非常感谢

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

如果有,我会提到它。