Reputation: 12325
Previously I had 3 items in my bottom navigation view, and 3 fragments associated with them. I am adding another item to it, and now there is white space on the sides, and I don't know where its coming from.
Here's the code for the bottom menu.
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_action_home"
android:title="@string/title_home" />
<item
android:id="@+id/navigation_learn"
android:icon="@drawable/ic_action_learn"
android:title="@string/title_learn" />
<item
android:id="@+id/navigation_guided"
android:icon="@drawable/ic_action_lotus"
android:title="@string/title_guided" />
<item
android:id="@+id/navigation_profile"
android:icon="@drawable/ic_action_profile"
android:title="@string/title_profile" />
</menu>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="?android:attr/windowBackground"
android:theme="@style/Widget.BottomNavigationView"
app:itemBackground="@color/colorBottomNavigationBackground"
app:itemIconTint="@color/bnv_tab_item_foreground"
app:itemTextColor="@color/bnv_tab_item_foreground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />
Does anyone know what's causing the white space?
Upvotes: 0
Views: 1777
Reputation: 1
Try it, android background and app item background
android:background="@color/colorBottomNavigationBackground"
app:itemBackground="@color/colorBottomNavigationBackground"
Upvotes: 0
Reputation: 11060
android:background="?android:attr/windowBackground"
to
android:background="your color"
#1F1F1F
Upvotes: 3