I built an App on Android Studio and I have some issues
I using RecyclerView
to show my data to the user but only on this Activity is the navbar that I created covered by the phone nav button as you can see in the photo
If you look closely, you can see the navigation buttons from my phone being shown above my navbar which I want to avoid.
this is my XML file
<androidx.constraintlayout.widget.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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="false"
app:layout_constraintBottom_toTopOf="@id/navbar"
tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="409dp"
android:layout_height="671dp"
android:layoutDirection="rtl"
android:paddingTop="@dimen/_30sdp"
android:paddingRight="@dimen/_5sdp"
android:paddingBottom="@dimen/_30sdp"
android:scrollbars="vertical"
app:layout_constrainedHeight="true"
app:layout_constrainedWidth="true"
android:clipToPadding="false"
app:layout_constraintBottom_toTopOf="@+id/navbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:clipToPadding="false"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:labelVisibilityMode="labeled"
android:foreground="?attr/selectableItemBackground"
android:layoutDirection="rtl"
style="@style/BottomNavigationView"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/navbar"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
I would like to see something like that:
I Tried to use android:fitsSystemWindows="true"
but it had no effect.
use 0dp in recyclerview height and weight and give four constraints top,left bottom and right.if this not work then use in on create method()
supportActionBar?.hide()
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN);