Как сохранить нижнюю навигацию в нижней части с помощью Scrollview с дочерним элементом LinearLayout в качестве корня - PullRequest
0 голосов
/ 10 октября 2019

Как сделать так, чтобы моя нижняя навигация оставалась внизу, а корневым родителем был Scrollview? Нижняя навигация не осталась внизу, когда я изменил своего корневого родителя, который является 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>

1 Ответ

0 голосов
/ 10 октября 2019

Попробуй так:

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