一:依赖
compile 'com.hjm:BottomTabBar:1.1.1'
public class MainActivity extends AppCompatActivity {
@BindView(R.id.bottomtabbar)
BottomTabBar bottomtabbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
bottomtabbar.init(getSupportFragmentManager())
.setImgSize(25, 25)
.setFontSize(8)
.setTabPadding(4, 6, 10)
.setChangeColor(Color.RED, Color.BLACK)
.addTabItem("精选", R.drawable.choiceness, ChoicenessFragment.class)
.addTabItem("专题", R.drawable.dissertation, DissertationFragment.class)
.addTabItem("发现", R.drawable.discover, DiscoverFragment.class)
.addTabItem("我的", R.drawable.my, MyFragment.class)
.isShowDivider(false)
.setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() {
@Override
public void onTabChange(int position, String name) {
}
})
.setTabBarBackgroundResource(R.drawable.bottom_bg)
.setBackgroundResource(R.drawable.bg_blue);
}
}