I'm creating an Android app with a BottomNavigationView and for some reason there is blank space on either side so it doesn't fill the whole width of the screen. It's not padding, because I removed the padding and I can see the shadow of the bottom view separating the blank area from the space above. Why are my four menu items not filling the entire width of the screen?
It looks good when I have three or five items so is this just a limitation of dividing the screen space into even numbers?
<com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="?android:attr/windowBackground" app:itemBackground="@color/colorPrimary" app:itemIconTint="@color/colorNavTint" app:itemTextColor="@color/colorNavText" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintStart_toStartOf="parent" app:menu="@menu/navigation" /> navigation Menu:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/navigation_discover" android:icon="@drawable/ic_discover" android:title="Discover"/> <item android:id="@+id/navigation_search" android:icon="@drawable/ic_search" android:title="Search"/> <item android:id="@+id/navigation_messages" android:icon="@drawable/ic_messages" android:title="Messages"/> <item android:id="@+id/navigation_orders" android:icon="@drawable/ic_orders" android:title="Orders"/> </menu> https://stackoverflow.com/questions/65605210/blank-space-either-side-of-bottomnavigationview January 07, 2021 at 08:45AM
没有评论:
发表评论