I wanna set colors blue into 'b', orange into 'c', purple into 'd', red into 'e'.
app:tabTextColor="@color/"
This xml code change 'all' colors of tab titles so I couldn't use it.
Can anyone help me please?
try this...
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
when (tab.getPosition()) {
case 0 : {
tabLayout.setTabTextColors(otherTabsColor,blueColor);
tabLayout.setSelectedTabIndicatorColor(ContextCompat.getColor(this, R.color.blue));
break;
}
case 1 : {
tabLayout.setTabTextColors(otherTabsColor,orangeColor);
tabLayout.setSelectedTabIndicatorColor(ContextCompat.getColor(this, R.color.orange));
break;
}
}
}
});