Summary
I try to make Bottom Navigation View with Java and android studio.
However, it disappears the bar regardless of showing exact screen in the xml file.
Goal
I'd like to show BottomNavigationView like this video.
Goal screen is below picture.
Issue
I am coding the video, and done. The xml file is exact screen layout, but when I build the screen, I saw different layout.
What I try
Compared to the code, almost all code isn't different.
Also turn off the fragment code, it works.
I guess the reason why it is disappear must be layout.
However, when I change the number of width or height, it shows same screen.
What's more, when I use layout construction such as Linerlayout, it shows same screen.
Code
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<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:background="@color/white"
tools:context=".home">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomnavi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_menu"/>
<fragment
android:id="@+id/fragment2"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="409dp"
android:layout_height="673dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/bottomnavi"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/my_nav" />
</androidx.constraintlayout.widget.ConstraintLayout>