【发布时间】: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