简介:Google推出的BottomNavigationBar底部导航栏

1 、基本的使用(add和replace方式)
2、扩展添加消息和图形
3、修改图片大小与文字间距

版本更新:2019-5-13

补充布局文件activity_main

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/activity_main"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="#ffffff"
 android:orientation="vertical">

 <FrameLayout
 android:id="@+id/tb"
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1" />

 <View
 android:layout_width="match_parent"
 android:layout_height="0.5dp"
 android:background="#eeeeee" />

 <com.ashokvarma.bottomnavigation.BottomNavigationBar
 android:id="@+id/bottom_navigation_bar"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_gravity="bottom" />

</LinearLayout>

1、默认使用studio背景图,防止少图片资源(效果图虽不尽人意~)

implementation 'com.ashokvarma.android:bottom-navigation-bar:2.0.4'