Android プロジェクトに問題があります。ボトムバーの色を変更できません。
これは、私のボトムバーをどのように見せたいかです:
これは私のコードです
メニュー > tabhost_bottom.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:id="@+id/home_item"
android:icon="@drawable/ic_home"
android:color="@color/colorPrimary"
android:title="Home"
/>
<item
android:id="@+id/setting_item"
android:icon="@drawable/ic_setting"
android:color="@color/colorPrimary"
android:title="Setting" />
HomeActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.tabhost_activity);
BottomBar bottomBar = BottomBar.attach(this, savedInstanceState);
bottomBar.setItemsFromMenu(R.menu.tabhost_bottom, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int itemId) {
}
});
// Set the color for the active tab. Ignored on mobile when there are more than three tabs.
bottomBar.setActiveTabColor("#55a8e5");
// Use the dark theme. Ignored on mobile when there are more than three tabs.
bottomBar.setBackgroundColor(Color.parseColor("#55a8e5"));
// Use custom text appearance in tab titles.
//bottomBar.setTextAppearance(R.style.MyTextAppearance);
// Use custom typeface that's located at the "/src/main/assets" directory. If using with
// custom text appearance, set the text appearance first.
//bottomBar.setTypeFace("MyFont.ttf");
}
そして、これは私の参照です
http://androidgifts.com/build-android-material-design-bottom-navigation/