簡體   English   中英

具有ScrimInsetsFrameLayout的狀態欄上的Scrim繪制在其子項下方

[英]Scrim on statusbar with ScrimInsetsFrameLayout draws below its childs

我想用Statusbar覆蓋的漸變來實現ActionBar。 我可以使用這樣的代碼:

<android.support.design.internal.ScrimInsetsFrameLayout
    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:fitsSystemWindows="true"
    app:insetForeground="#4000"
    android:background="#e23">
    <View
        android:layout_width="match_parent"
        android:layout_height="140dp" />
</android.support.design.internal.ScrimInsetsFrameLayout>

具有:

http://i.stack.imgur.com/ubBIy.png

但是,當我(作為孩子)在ScrimInsetsFrameLayout中添加任何內容時,此視圖(在下面)覆蓋了頂部的稀松布:

<android.support.design.internal.ScrimInsetsFrameLayout
    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:fitsSystemWindows="true"
    app:insetForeground="#4000">
    <android.support.v7.widget.Toolbar
        xmlns:toolbar="http://schemas.android.com/apk/res-auto"
        toolbar:theme="@style/styleActionBarThemeOverlay"
        toolbar:popupTheme="@style/styleActionBarPopupThemeOverlay"
        android:id="@+id/toolbar"
        android:background="@drawable/gradient_actionbar"
        toolbar:titleTextAppearance="@style/styleToolbarTitle"
        toolbar:contentInsetStart="0dp"
        android:layout_width="match_parent"
        android:layout_height="?actionBarSize" />
</android.support.design.internal.ScrimInsetsFrameLayout>

屏幕:

http://i.stack.imgur.com/8WFTN.png

由於下一個設計計划,我無法將背景設置為ScrimInsetsFrameLayout。 如何迫使稀松布在其他要素之上?

我受夠了:ScrimInsetsFrameLayout如果沒有背景,則不會起作用。

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
    android:fitsSystemWindows="true">
<android.support.design.internal.ScrimInsetsFrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#f29"
    android:fitsSystemWindows="true">

    <include layout="@layout/toolbar" />

</android.support.design.internal.ScrimInsetsFrameLayout>
<FrameLayout
    android:id="@+id/navigation"
    android:layout_width="@dimen/navigation_drawer_width"
    android:layout_height="match_parent"
    android:layout_gravity="left|start">

</FrameLayout>

暫無
暫無

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

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