BottomTabBar

<com.hjm.bottomtabbar.BottomTabBar
        xmlns:hjm="http://schemas.android.com/apk/res-auto"
        android:id="@+id/bottom_tab_bar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        hjm:tab_font_size="10sp"
        hjm:tab_img_font_padding="5dp"
        hjm:tab_img_height="30dp"
        hjm:tab_img_width="30dp"
        hjm:tab_padding_bottom="3dp"
        hjm:tab_padding_top="5dp"
        hjm:tab_selected_color="#f00"
        hjm:tab_unselected_color="#000"
        />
//去掉标题栏
        supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tabBar= (BottomTabBar) findViewById(R.id.bottom_tab_bar);
        //这个init ( getSupportFragmentManager() )方法一定要第一个调用,没有//这个初始化,后边什么也做不了。
        tabBar.init(getSupportFragmentManager())
                .addTabItem("首页",R.drawable.home1, R.drawable.home2, HomeFragment.class)
                .addTabItem("购物车",  R.drawable.shop2,  R.drawable.shoe1,ShopFragment.class)
                .addTabItem("订单",R.drawable.a2, R.drawable.a1, DingFragment.class)
                .addTabItem("我的",R.drawable.my2, R.drawable.my1, MyFragment.class)
                .isShowDivider(true);

猜你喜欢

转载自blog.csdn.net/l6666_6666/article/details/80603676