-
设置显示模式
app:labelVisibilityMode="labeled" |selected|unselected|auto
-
设置字体颜色
app:itemTextColor="@drawable/sel_text_color_select"
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@color/black" android:state_selected="true"/> <item android:color="@color/gray_999999"/> </selector>
-
设置按钮
app:menu="@menu/main_bottom_tab"
图片选择会失效,需要加上:mNavView.setItemIconTintList(null);
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/main_photo" android:icon="@drawable/sel_bottom_photo" android:title="照片"/> </menu>
-
设置文字字体大小
<dimen name="design_bottom_navigation_text_size" tools:override="true">10sp</dimen> <dimen name="design_bottom_navigation_active_text_size" tools:override="true">10sp</dimen>
-
设置图标距离顶部的距离
<dimen name="design_bottom_navigation_margin" tools:override="true">10dp</dimen>
-
事件监听
mNavView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
BottomNavigationView使用
最新推荐文章于 2024-10-12 12:43:02 发布