我想實現的底部導航欄,使用AHBottomNavigation庫在:https://github.com/aurelhubert/ahbottomnavigationAHBottomNavigation不變色的Android
我的導航欄的顏色不會改變 - 連鎖反應發生,文字是完美的。我的應用欄保持一種顏色。這裏是代碼:
public void initializeNavigationBar()
{
menuItemsList = new ArrayList<>();
bottomNavigation = (AHBottomNavigation) findViewById(R.id.bottom_navigation_bar);
menuItemsList.add(new AHBottomNavigationItem("Home", R.drawable.home, R.color.colorPrimary));
menuItemsList.add(new AHBottomNavigationItem("View Profile", R.drawable.person_profile, R.color.colorPrimary));
menuItemsList.add(new AHBottomNavigationItem("Map a Route", R.drawable.route, R.color.colorPrimary));
menuItemsList.add(new AHBottomNavigationItem("Start Run", R.drawable.start_run, R.color.colorPrimary));
bottomNavigation.addItems(menuItemsList);
bottomNavigation.setAccentColor(Color.parseColor("#FF5722"));
bottomNavigation.setInactiveColor(Color.parseColor("#FF5722"));
bottomNavigation.setColored(true);
bottomNavigation.setForceTint(true);
bottomNavigation.setCurrentItem(0);
bottomNavigation.setBehaviorTranslationEnabled(false);
bottomNavigation.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
bottomNavigation.setOnTabSelectedListener(this);
}
@Override
public void onTabSelected(int position, boolean wasSelected) {
switch (position) {
case 0:
AthleteLandingFragment homeScreen = new AthleteLandingFragment();
FragmentTransaction homeTransaction = mgr.beginTransaction();
homeTransaction.replace(R.id.MainActivityContentArea, homeScreen,
"AthleteLandingFragment");
homeTransaction.addToBackStack("AthleteLandingFragment");
toolbarTextView.setText("Athlete Landing Screen");
homeTransaction.commit();
break;
我不知道我在做什麼錯。我想酒吧是藍色的。我嘗試使用setDefaultBackgroundColor,並沒有工作。
請幫