botab = findViewById(R.id.bottomTab); botab.init(getSupportFragmentManager()).setImgSize(50,50) .setFontSize(10) .setTabPadding(4,6,10) // .setBackgroundColor(Color.BLACK) .setChangeColor(Color.RED,Color.BLACK) // .setBackground(Color.BLACK) .addTabItem("首页",R.drawable.fist,FirstFragment.class) .addTabItem("街头",R.drawable.twono,TwoFragment.class) .isShowDivider(false) .setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() { @Override public void onTabChange(int position, String name) { } });
<com.hjm.bottomtabbar.BottomTabBar android:id="@+id/bottomTab" android:layout_width="match_parent" android:layout_height="match_parent" />