京东界面之底部导航栏

//Java哦
public class Jingdong extends AppCompatActivity {
    private BottomTabBar bottab;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jingdong);
        BottomTabBar bottab = (BottomTabBar) findViewById(R.id.bottab);


        bottab.init(getSupportFragmentManager())
                .setImgSize(120,120)
                .setFontSize(0)
                .setTabPadding(4,6,10)
                .setChangeColor(Color.RED,Color.DKGRAY)//点击切换颜色
                .addTabItem(null,R.drawable.ac0, Shou.class)
                .addTabItem(null,R.drawable.abw, Fenlei.class)
                .addTabItem(null,R.drawable.abu,Car.class)
                .addTabItem(null,R.drawable.ac2,Mine.class)
                .isShowDivider(false)

                .setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() {

                    @Override
                    public void onTabChange(int position, String name) {

                    }
                });
    }
}
//xml哦
<com.hjm.bottomtabbar.BottomTabBar
    android:id="@+id/bottab"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

com.hjm.bottomtabbar.BottomTabBar>
//依赖呢
compile 'com.hjm:BottomTabBar:1.1.1'


你可能感兴趣的:(自娱自乐)