我有一个底部导航栏,其中包含3个项目。我想要每个标签都仅有居中的文本,因此希望完全删除图标(不只是使它们透明)。
如何删除图标并将标题居中?
我的代码: (更喜欢在XML中提供解决方案)
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentBottom="true">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/navigationBar"
android:background="@color/navigation"
app:theme="@style/BottomNavigationTheme"
app:menu="@menu/bottom_navigation_menu"
android:minHeight="@dimen/abc_action_bar_default_height_material">
</com.google.android.material.bottomnavigation.BottomNavigationView>
</RelativeLayout>
</merge>
bottom_navigation_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/ic_home"
android:title="@string/home">
</item>
<item
android:id="@+id/ic_today"
android:title="@string/today">
</item>
<item
android:id="@+id/ic_you"
android:title="@string/you">
</item>
</menu>