Android_BottomTabBar

一:依赖

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);
    }
}




你可能感兴趣的:(Android_BottomTabBar)