1

This is my activity layout

<?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/parent"
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/dp56"
            android:background="@color/colorWhite"
            android:elevation="@dimen/dp5"
            android:minHeight="?attr/actionBarSize"
            app:layout_constraintBottom_toTopOf="@id/nav_host_fragment"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_chainStyle="packed"
            app:titleTextColor="@android:color/black">

            <TextView
                android:id="@+id/toolBarTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:textColor="@color/colorBlack"
                android:textSize="@dimen/text16" />
        </androidx.appcompat.widget.Toolbar>

        <androidx.fragment.app.FragmentContainerView
            android:id="@+id/nav_host_fragment"
            android:name="androidx.navigation.fragment.NavHostFragment"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:defaultNavHost="true"
            app:layout_constraintBottom_toTopOf="@id/bottom_nav"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/toolbar" />

        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottom_nav"
            android:layout_width="match_parent"
            android:layout_height="@dimen/dp72"
            android:background="@color/colorWhite"
            app:elevation="@dimen/dp15"
            app:itemTextAppearanceActive="@style/MyBottomNavigationView.TextAppearance"
            app:itemTextAppearanceInactive="@style/MyBottomNavigationView.TextAppearance"
            app:itemIconTint="@color/bottom_nav_icon_color_selector"
            app:itemTextColor="@color/bottom_nav_text_color"
            android:theme="@style/BottomNavigationViewStyle"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:menu="@menu/bottom_nav" />
    </androidx.constraintlayout.widget.ConstraintLayout>

This looks like this

When I set android:fitsSystemWindows="false"

it looks like enter image description here

This is my bottom nav style

<style name="BottomNavigationViewStyle" parent="MainThemeV2">
    <item name="colorSecondaryContainer">@null</item>
    <item name="colorError">@color/v2Secondary</item>
    <item name="labelVisibilityMode">labeled</item>
</style>

Why is this happening and how can I fix this??

hushed_voice
  • 3,161
  • 3
  • 34
  • 66

0 Answers0