应通过透明状态栏显示SlidingUpPanelLayout

时间:2018-04-22 20:25:45

标签: android android-layout statusbar slidingpanelayout

我正在开发一个带有SlidingUpPanelLayout(com.sothree.slidinguppanel.SlidingUpPanelLayout)的应用。展开此布局时,它应填满屏幕,直到状态栏的顶部。但状态栏并不完全透明。

我已尝试将窗口标记设置为View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN,并将<item name="android:windowTranslucentStatus">true</item>添加为true。 它实际上适用于导航抽屉,但不适用于SlidingUpPanelLayout。

activity_main.xml中:

<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/mDrawerLayout"
    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:fitsSystemWindows="true">

        <include layout="@layout/layout_slidingpanel" />
    </android.support.design.internal.ScrimInsetsFrameLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/mNavigationView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/layout_drawer_header"
        app:menu="@menu/menu_drawer" />

</android.support.v4.widget.DrawerLayout>

layout_slidingpanel.xml:

<?xml version="1.0" encoding="utf-8"?>
<com.sothree.slidinguppanel.SlidingUpPanelLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:id="@+id/mSlidingPanelLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoOverlay="false"
    sothree:umanoPanelHeight="0dp"
    sothree:umanoShadowHeight="@dimen/cardview_default_elevation">

    <FrameLayout
        android:id="@+id/mActivityContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <FrameLayout
        android:id="@+id/slidingpanel"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/mPlayerContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <fragment
            class="at.guger.musixs.fragment.player.MiniPlayerFragment"
            android:id="@+id/mMiniPlayerFragment"
            android:layout_width="match_parent"
            android:layout_height="@dimen/miniplayer_height" />
    </FrameLayout>

</com.sothree.slidinguppanel.SlidingUpPanelLayout>

如何将状态栏设置为透明或如何创建布局以获得完全可见的布局?

提前致谢!

0 个答案:

没有答案