As you can see in the source code, you should implement the interface below
public interface TabColorizer { int getIndicatorColor(int position); int getDividerColor(int position); }
and install it by calling the method below from mSlidingTabLayout
public void setCustomTabColorizer(TabColorizer tabColorizer) { mTabStrip.setCustomTabColorizer(tabColorizer); }
or you can just change
private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFFF49e04;
from the SlidingTabStrip class.
Edited by:
your main action or any objects that you want to control the color should implement the interface below:
public class MainActivity extends FragmentActivity implements SlidingTabLayout.TabColorizer
then in the override methods, select your color according to the position:
@Override public int getIndicatorColor(int position) { return (Your color value ); } @Override public int getDividerColor(int position) { return (Your color value ); }
Then you must pass this object to SlidingTab.
source share