使SlidingUpPanelLayout站在底部导航栏上方

解散

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

现在看起来如何

有我的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>
阿里王子

一个不错的方法是使用aRelativeLayout作为父级,然后将Panel和Nav Bar设置为子级。这是一个简单的例子:

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

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章