Нижняя навигация и фрагмент перекрываются

Как вы можете видеть на этой картинке

нижняя панель навигации и текстовые поля перекрываются.

в чем может быть причина такого странного поведения моего приложения?

вот xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".fragment.ApplicationFragment">
    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:paddingLeft="5dp"
        android:fillViewport="true">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_amount_applied"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/amount_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="numberDecimal"
                            android:hint="Amount Applied" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:hint="Mode of payment">
                        <AutoCompleteTextView
                            android:id="@+id/filled_exposed_dropdown"
                            android:layout_width="match_parent"
                            android:maxLines="1"
                            android:editable="false"
                            android:layout_height="wrap_content"/>
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_term"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/term_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="number"
                            android:hint="Term" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="INDIVIDUAL INFORMATION"
                android:textSize="20dp"
                android:layout_marginBottom="10dp"/>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_last_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/lastname_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Lastname" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_first_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/firstname_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Firstname" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_middle_name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/middlename_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:hint="Middlename" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:baselineAligned="false">
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_birthdate"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/birthdate_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:editable="false"
                            android:inputType="date"
                            android:hint="Birthdate" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/text_age"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        app:errorEnabled="true">
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/age_edit_text"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:maxLines="1"
                            android:inputType="number"
                            android:hint="Age" />
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
                <RelativeLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1">
                    <com.google.android.material.textfield.TextInputLayout
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:hint="Sex">
                        <AutoCompleteTextView
                            android:id="@+id/sex_exposed_dropdown"
                            android:layout_width="match_parent"
                            android:maxLines="1"
                            android:editable="false"
                            android:layout_height="wrap_content"/>
                    </com.google.android.material.textfield.TextInputLayout>
                </RelativeLayout>
            </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</FrameLayout>

и это activity_main.xml

<com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout
    android:id="@+id/frame_container"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        app:itemBackground="@color/colorPrimary"
        android:foreground="?attr/selectableItemBackground"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"
        app:menu="@menu/bottom_nav_menu" />

</com.google.android.material.circularreveal.coordinatorlayout.CircularRevealCoordinatorLayout>

кстати, я просто продублировал, скопировал и вставил 10 или более раз дату рождения, возраст и пол, чтобы проверить, прокручивается ли фрагмент. в конце концов, после того, как я запустил приложение, как вы можете видеть на картинке, нижняя панель навигации и текстовые поля теперь перекрываются.


person Jeffrey Oliveras    schedule 27.05.2019    source источник
comment
Будет ли нормально, если вы покажете мне свой XML-файл main_activity, в котором отображается bottomNavigationView? Потому что проблема есть.   -  person Prince Dholakiya    schedule 27.05.2019
comment
@DPrince добавил файл xml. Пожалуйста, проверьте это   -  person Jeffrey Oliveras    schedule 27.05.2019
comment
Почему вы используете CircularRevealCoordinatorLayout и где находится ваш макет загрузки фрагмента.   -  person Prince Dholakiya    schedule 27.05.2019
comment
Разве это не полезно?   -  person Jeffrey Oliveras    schedule 27.05.2019
comment
Если вы хотите использовать его для какой-то цели, то его можно использовать, в противном случае использовать его нецелесообразно.   -  person Prince Dholakiya    schedule 27.05.2019


Ответы (1)


предположим, что ваша BottomNavigationView высота составляет 60dp, вы можете избежать такого поведения, добавив этот атрибут к вашему NestedScrollView

  android:layout_marginBottom="60dp"
person ismail alaoui    schedule 27.05.2019