BottomBar,简单可直接导入的底部导航栏。
食用方式
1.只需要到给出的github地址中拷贝BottomBar类到项目包下即可
2.xml中
<com.example.bottombar.BottomBar android:background="#FFFFFF" android:id="@+id/bottom_bar" android:layout_width="match_parent" android:layout_height="46dp" android:layout_gravity="bottom" />
3.java代码中
BottomBar bottomBar = findViewById(R.id.bottom_bar); bottomBar.setContainer(R.id.fl_container) .setTitleBeforeAndAfterColor("#999999", "#ff5d5e") .addItem(Fragment1.class, "首页", R.drawable.item1_before, R.drawable.item1_after) .addItem(Fragment2.class, "订单", R.drawable.item2_before, R.drawable.item2_after) .addItem(Fragment3.class, "我的", R.drawable.item3_before, R.drawable.item3_after) .build();
转载自:https://github.com/xubinhong/BottomBar