I've seen several apps smoothly changing their indicator color (even icons!) on tab swipe for example Facebook.
This is how I do it in my app :
tabLayout.setOnTabSelectedListener(
new TabLayout.ViewPagerOnTabSelectedListener(searchViewPager) {
@Override
public void onTabSelected(TabLayout.Tab tab) {
super.onTabSelected(tab);
tabLayout.setSelectedTabIndicatorColor(getResources().getColor(indicatorColors[tab.getPosition()]));
}
});
Where indicatorColors is an array of normal color, and thus it only changes when user completely swipes to a tab or select the tab. I need the transition here.
What can I do to get a smooth color transition from one color to another color on tab swipe?
TabLayout
is coupled with a ViewPager
.