底部导航栏

 private BottomTabBar mBottomTabBar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        mBottomTabBar = findViewById(R.id.bottom_tab_bar);
        mBottomTabBar.init(getSupportFragmentManager())
                .setChangeColor(Color.RED, Color.GRAY)
                .setImgSize(100, 100)
                .setFontSize(0)
                .addTabItem("首页", R.mipmap.ac1, R.mipmap.ac0, HomeFragment.class)
                .addTabItem("分类", R.mipmap.abx, R.mipmap.abw, CatefindFragment.class)
                .addTabItem("购物车", R.mipmap.abv, R.mipmap.abu, ShoppingFragment.class)
                .addTabItem("个人中心", R.mipmap.ac3, R.mipmap.ac2, MineFragment.class)
                .isShowDivider(false);

    }

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>

依赖

compile 'com.hjm:BottomTabBar:1.1.2'



猜你喜欢

转载自blog.csdn.net/qq_41673730/article/details/80471500