使 SlidingUpPanelLayout 站在底部导航栏上方

Make SlidingUpPanelLayout stand above the bottom navbar

如何让SlidingUpPanelLayout 位于底部导航栏上方?现在我的滑动面板位于导航栏下方,因为在“SlidingUpPanelLayout”代码中,滑动布局必须位于主布局下方。我不知道该怎么做

how its looks like now

有我的xml文件

<com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
tools:context=".NavActivity"
app:umanoPanelHeight="70dp"
app:umanoShadowHeight="5dp">
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:background="#9275B8FA"
        android:id="@+id/nav_back" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/bottom"
        android:id="@+id/fragment_container"/>

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:id="@+id/bottom"
        android:layout_alignParentBottom="true"
        android:layout_height="48dp">

        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottom_navigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:menu="@menu/bottom_navbar"
            android:background="@color/blue"
            app:itemIconTint="@color/whiteDarker"
            app:labelVisibilityMode="unlabeled"
            app:itemTextColor="@color/white"
            />
    </com.google.android.material.appbar.AppBarLayout>
</RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <include layout="@layout/mini_player" />
</RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

一个不错的方法是使用 RelativeLayout 作为父项,然后将面板和导航栏设置为子项。这是一个简单的例子:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<!-- Notice the attribute layout above -->
<com.sothree.slidinguppanel.SlidingUpPanelLayout
        android:id="@+id/nav_activity"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="bottom"
        android:layout_above="@+id/bottom_navigation"
        tools:context=".NavActivity"
        app:umanoPanelHeight="70dp"
        app:umanoShadowHeight="5dp">

       <!-- Fragment container here -->

       <!-- Mini Player here -->

</com.sothree.slidinguppanel.SlidingUpPanelLayout>

<!-- Notice the alignParentBottom true -->
<com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottom_navigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            app:menu="@menu/bottom_navbar"
            android:background="@color/blue"
            app:itemIconTint="@color/whiteDarker"
            app:labelVisibilityMode="unlabeled"
            app:itemTextColor="@color/white" />

</RelativeLayout>