//添加依赖
compile 'com.hjm:BottomTabBar:1.1.1'
//XML布局
<com.hjm.bottomtabbar.BottomTabBar
android:layout_alignParentBottom="true"
android:id="@+id/bottomTabBar"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.hjm.bottomtabbar.BottomTabBar>
//MainActivity代码
btb.init(getSupportFragmentManager())
.setImgSize(50, 50)//图片大小
.setFontSize(16)//字体大小
.setTabPadding(4,6,7)//边距
.setChangeColor(Color.RED,Color.GRAY)//字体颜色和图片颜色
.addTabItem("首页",R.drawable.shouye, PageShou.class)
.addTabItem("分类",R.drawable.fenlei, PageFen.class)
.addTabItem("发现",R.drawable.faxian, PageFa.class)
.addTabItem("购物车",R.drawable.gouwuche, PageGou.class)
.addTabItem("我的",R.drawable.wode, PageWo.class)
.isShowDivider(true)
.setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() {
@Override
public void onTabChange(int position, String name) {
}
});