简体   繁体   中英

How to change the color of status bar in sdk version under kitkat

I want to make statusbar's color as the color of toolbar. But i don't known how to do it in android sdk version under kitkat. This is my toolbar layout:

<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>

It is my app theme: @color/white @color/white @dimen/text_sub_title_size

Many thanks in advance!

You can't. Simple as that. KitKat is the first version that supported transparency of any kind in the status bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM