我正在尝试使用位于:https://github.com/aurelhubert/ahbottomnavigation的ahbottomnavigation库实现底部导航栏。
我的导航条的颜色没有改变-涟漪效应发生了,文本是完美的。我的应用程序栏保持一种颜色。代码如下:

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,但没有成功。
请帮忙

最佳答案

我也面临同样的问题,我也找到了解决办法:
BottomNavigation.setcolored(错误);
请使用上面提到的代码来解决这个问题,它对我很好。

10-04 14:09