簡體   English   中英

如何在Kitkat下的sdk版本中更改狀態欄的顏色

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

我想將狀態欄的顏色設為工具欄的顏色。 但是我不知道如何在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>

這是我的應用程序主題:@ color / white @ color / white @ dimen / text_sub_title_size

提前謝謝了!

你不能 就那么簡單。 KitKat是第一個在狀態欄中支持任何類型透明度的版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM