package com.bwie.jd.view.activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import com.bwie.jd.R;
import com.bwie.jd.model.bean.HomeBean;
import com.bwie.jd.presenter.MainPresenter;
import com.bwie.jd.view.IView.IMainView;
import com.bwie.jd.view.fragment.ClassifyFragment;
import com.bwie.jd.view.fragment.HomeFragment;
import com.bwie.jd.view.fragment.MessageFragment;
import com.bwie.jd.view.fragment.MyFragment;
import com.bwie.jd.view.fragment.ShopFragment;
import com.hjm.bottomtabbar.BottomTabBar;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends BaseActivity{
@BindView(R.id.bottom_tab_bar)
BottomTabBar bottomTabBar;
private HomeFragment home;
private ClassifyFragment classify;
private MessageFragment message;
private ShopFragment shop;
private MyFragment my;
private FragmentManager manager;
private MainPresenter mainPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
//底部导航
dibu();
}
//底部导航
private void dibu() {
bottomTabBar.init(getSupportFragmentManager())
.setImgSize(26,26)
.setFontSize(14)
.setTabPadding(4,6,10)
.setChangeColor(Color.RED,Color.DKGRAY)
.addTabItem("首页", R.drawable.home, HomeFragment.class)
.addTabItem("分类", R.drawable.classily, ClassifyFragment.class)
.addTabItem("消息", R.drawable.sou, MessageFragment.class)
.addTabItem("购物车", R.drawable.shop, ShopFragment.class)
.addTabItem("我的", R.drawable.my, MyFragment.class)
.setTabBarBackgroundColor(Color.WHITE)
.isShowDivider(false);
}
}
<?xml version="1.0" encoding="utf-8"?><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_divider_background="#FF0000"
hjm:tab_divider_height="5dp"
hjm:tab_font_size="6sp"
hjm:tab_img_font_padding="0dp"
hjm:tab_img_height="30dp"
hjm:tab_img_width="30dp"
hjm:tab_isshow_divider="true"
hjm:tab_padding_bottom="5dp"
hjm:tab_padding_top="8dp"
hjm:tab_selected_color="#000000"
hjm:tab_unselected_color="@color/colorPrimary"
/>