0

如何使我的底部导航保持在底部,根父级为 Scrollview?当我更改我的根父级滚动视图时,底部导航没有停留在底部。

<ScrollView 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"
    android:background="@color/white"
    android:fillViewport="true"
    tools:context=".ManageActivity">

    <LinearLayout ... >

        <androidx.cardview.widget.CardView ...>

 <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/btm_nav"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@color/purple"
            android:clipToPadding="false"
            app:itemIconTint="@color/bottom_nav_color"
            app:itemTextColor="@color/bottom_nav_color"
            app:menu="@menu/bottom_nav" />

    </LinearLayout>


</ScrollView>

4

1 回答 1

0

试试这样:

<?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:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/navigation" >
        <!--Other Stuff here-->
    </ScrollView>

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/purple"
        android:clipToPadding="false"
        app:itemIconTint="@color/bottom_nav_color"
        app:itemTextColor="@color/bottom_nav_color"
        app:menu="@menu/bottom_nav" />

</RelativeLayout>
于 2019-10-10T08:45:38.870 回答