一、导依赖
compile 'com.hjm:BottomTabBar:1.1.1'
二、Xml布局中
-
<com.hjm.bottomtabbar.BottomTabBar
-
android:id="@+id/bottom_tab_bar"
-
android:layout_width="match_parent"
-
android:layout_height="match_parent"
-
>
-
</com.hjm.bottomtabbar.BottomTabBar>
三、Activity中,把它放在initView方法中
-
bottom_tab_bar.init(getSupportFragmentManager())
-
.setImgSize(50, 50)
-
.setFontSize(20)
-
.setChangeColor(Color.RED, Color.DKGRAY)
-
.addTabItem("主页",null,null, OneFragment.class)
-
.addTabItem("发现", null, null, TwoFragment.class)
-
.addTabItem("成长", null, null, ThreeFragment.class)
-
.addTabItem("我的", null, null, FourFragment.class)
-
.isShowDivider(false);