【问题标题】:How do i change the colour of the status bar?如何更改状态栏的颜色?
【发布时间】:2016-03-12 04:46:11
【问题描述】:

我添加了一个 CollapsingToorbar,保留 android:foreground=#bd1212 。但是当它折叠状态栏颜色成为默认颜色。 有人可以告诉我如何更改状态栏的颜色吗?

【问题讨论】:

    标签: android xml android-layout android-actionbar


    【解决方案1】:

    属性“contentScrim”是您正在寻找的:

    <android.support.design.widget.CoordinatorLayout
        android:id="@+id/place_activity_coordinator"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FFFF">
            ...
            ...
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/place_activity_collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="#8000" <!-- This color is what you need to change -->
            app:expandedTitleTextAppearance="@style/collapsing_toolbar_expanded"
            app:collapsedTitleTextAppearance="@style/collapsing_toolbar_collapsed"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">
    

    【讨论】:

    • 我确实尝试过更改 contentScrim 属性。那不行。这同样适用于普通的工具栏。更改其颜色不会更改状态栏颜色。我一直在寻找改变状态栏颜色的属性。
    猜你喜欢
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-25
    • 2019-10-27
    相关资源
    最近更新 更多