Open Misbah-Ahmad opened 6 years ago
Could you try ContextCompat.getColor(context, R.color.white)
?
I figured it out, i had the opposite problem of yours. You've put bottomNavigation.setCurrentItem(0);
and i've put mNavigationViewPager.setCurrentItem(1);
. The first one sets the selected tab in the bottom bar, the second one sets the whole content based on the index. you need to add both of them
You need to set the color like this:
bottomNavigation.setAccentColor(getResources().getColor(R.color.colorPrimary));
I've tried all constructors of Navigation Items, Setting up the setAccentColor(), setInactiveColor(), But the active and inactive colors of text and icon aren't changing! It gets a default color from nowhere.
my activity code :
`
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import com.aurelhubert.ahbottomnavigation.AHBottomNavigation; import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity implements AHBottomNavigation.OnTabSelectedListener{
/ navigationHomeItem = new AHBottomNavigationItem(R.string.title_home, R.drawable.ic_home_black_24dp, R.color.colorPrimary); navigationTrendingItem = new AHBottomNavigationItem(R.string.title_trending, R.drawable.ic_dashboard_black_24dp, R.color.colorPrimary); navigationReviewItem = new AHBottomNavigationItem(R.string.title_review, R.drawable.ic_notifications_black_24dp, R.color.colorPrimary); navigationSuggestionItem = new AHBottomNavigationItem(R.string.title_suggestion, R.drawable.ic_home_black_24dp, R.color.colorPrimary); /
/ bottomNavigation.addItem(navigationHomeItem); bottomNavigation.addItem(navigationTrendingItem); bottomNavigation.addItem(navigationReviewItem); bottomNavigation.addItem(navigationSuggestionItem); /
} `