Set container layout above BottomNavigationView

Set container layout above BottomNavigationView


I have used a FrameLayout to prevent the BottomNavigationView from overlapping with layouts above it.

<?xml version=”1.0″ encoding=”utf-8″?>
<android.support.constraint.ConstraintLayout 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”
    tools:context=”com.xxx.xxx.xxxx”>
    <FrameLayout
        android:id=”@+id/fragment_container”
        android:layout_width=”0dp”
        android:layout_height=”0dp”
        app:layout_constraintTop_toTopOf=”parent”
        app:layout_constraintBottom_toTopOf=”@+id/navigation”
        app:layout_constraintLeft_toLeftOf=”parent”
        app:layout_constraintRight_toRightOf=”parent”>
        <include
          layout=”@layout/app_bar_main”
          android:layout_width=”match_parent”
          android:layout_height=”match_parent” />
    </FrameLayout>
    <android.support.design.widget.BottomNavigationView
        android:id=”@+id/navigation”
        android:layout_width=”0dp”
        android:layout_height=”wrap_content”
        android:layout_marginEnd=”0dp”
        android:layout_marginStart=”0dp”
        android:background=”?android:attr/windowBackground”
        app:layout_constraintBottom_toBottomOf=”parent”
        app:layout_constraintLeft_toLeftOf=”parent”
        app:layout_constraintRight_toRightOf=”parent”
        app:menu=”@menu/navigation” />
</android.support.constraint.ConstraintLayout>

Related posts

Leave a Comment