Make SlidingUpPanelLayout stand above the bottom navbar

Viewed 442

How to make SlidingUpPanelLayout stand above the bottom navbar? Now my sliding panel standing below navbar because in code of "SlidingUpPanelLayout" sliding layout have to be below of main layout. I have no idea how to do it

how its looks like now

There is my xml file

<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>
1 Answers

A nice way would be to use a RelativeLayout as parent then set the Panel and Nav Bar as children. Here's a quick example:

<?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>

enter image description here

Related