Android BottomNavigationView 菜单项名称无法显示的解决方法
根据您提供的代码,我注意到您的BottomNavigationView的宽度和高度都设置为wrap_content,这可能导致菜单项的名称无法显示出来。
您可以尝试将BottomNavigationView的宽度设置为match_parent,以确保它占据整个父容器的宽度。修改代码如下:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemIconTint="#6AF321"
app:itemTextColor="#28F321"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_menu" />
请尝试修改代码并重新运行应用程序,看看是否能够解决菜单项名称无法显示的问题。如果问题仍然存在,请提供更多关于布局和相关代码的信息,以便更好地帮助您解决问题。
原文地址: https://www.cveoy.top/t/topic/ELV 著作权归作者所有。请勿转载和采集!