1
votes

BottomNavigationView hides some part of the view which behinds the screen.

How can I show view above the footer (BottomNavigationView)

I have edited the below and updated the mainactivity.xml file

Also, the xml file which I have added the another xml like below

enter image description here

one of my xml

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android:id="@+id/refresh_layout"
    android:layout_width="match_parent"
    app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
    android:layout_height="match_parent"

    android:background="@color/colorPrimary"
    tools:ignore="NotSibling,RtlHardcoded">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@null">
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

mainactivity.xml

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">

    <androidx.drawerlayout.widget.DrawerLayout
        android:id="@+id/root_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        android:background="@null"
        tools:ignore="NotSibling,UnknownId">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@null">

            <FrameLayout
                android:id="@+id/fragment_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@null"
                android:paddingBottom="?attr/actionBarSize"
                android:paddingTop="?attr/actionBarSize"/>

          
            <View
                android:id="@+id/divider_toolbar"
                android:layout_width="match_parent"
                android:layout_height="@dimen/stroke"
                android:layout_marginTop="?attr/actionBarSize"
                android:background="@color/colorPrimary"/>
            <FrameLayout
                android:id="@+id/footer_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
                <com.google.android.material.bottomnavigation.BottomNavigationView
                    android:layout_gravity="bottom"
                    android:background="@drawable/curved_shape_footer"
                    android:id="@+id/bottom_navigation"
                    android:layout_width="match_parent"
                    app:itemBackground="?selectableItemBackgroundBorderless"
                    app:itemHorizontalTranslationEnabled="false"
                    app:menu="@menu/bottom_navigation"
                    app:labelVisibilityMode="unlabeled"
                    android:layout_alignParentBottom="true"
                    android:layout_height="wrap_content"/>
            </FrameLayout>
</...>
</...>
</...>
1

1 Answers

0
votes

Use constraints layout and set constraint to your top root view as app:layout_constraintBottom_toTopOf="@id/bottomNavigationView".

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
    android:id="@+id/refresh_layout"
    android:layout_width="match_parent"
    android:layout_height="0dp"      
    android:background="@color/colorPrimary"
    tools:ignore="NotSibling,RtlHardcoded"
     app:layout_constraintTop_toTopOf="parent" 
    app:layout_constraintBottom_toTopOf="@id/bottom_navigation">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@null">

</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

<com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottomNavigationView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/bottom_nav_menu" />

</androidx.constraintlayout.widget.ConstraintLayout>