2015-09-06 97 views
0

我想讓狀態欄的顏色作爲工具欄的顏色。但我不知道如何在kitkat下的android sdk版本中做到這一點。 這是我的工具欄佈局:如何更改狀態欄的顏色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> 

這是我的應用程序的主題: @色/白色 @彩色/提前白色 @捫/ text_sub_title_size

非常感謝!

回答

0

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

+0

謝謝凱恩。 – Alex

+0

是否有任何方法(解決方法)? – Alex

+0

如果有的話,我會提到它。 –