diff --git a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java index c29ec368..a55d75f0 100644 --- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java +++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java @@ -130,6 +130,7 @@ public class BottomBar extends RelativeLayout implements View.OnClickListener, V private boolean mShouldUpdateFragmentInitially; private int mMaxFixedTabCount = 3; + private boolean mForceUseCustomActiveColor = false; /** * Bind the BottomBar to your Activity, and inflate your layout here. @@ -614,6 +615,13 @@ public void useDarkTheme() { mIsDarkTheme = true; } + /** + * Always use custom color for selected tab + */ + public void forceUseCustomColor() { + mForceUseCustomActiveColor = true; + } + /** * Ignore the automatic Night Mode detection and use a light theme by default, * even if the Night Mode is on. @@ -1398,7 +1406,7 @@ private void selectTab(View tab, boolean animate) { int tabPosition = findItemPosition(tab); - if (!mIsShiftingMode || mIsTabletMode) { + if (mForceUseCustomActiveColor || (!mIsShiftingMode || mIsTabletMode)) { int activeColor = mCustomActiveTabColor != 0 ? mCustomActiveTabColor : mPrimaryColor; icon.setColorFilter(activeColor); @@ -1463,7 +1471,7 @@ private void unselectTab(View tab, boolean animate) { ImageView icon = (ImageView) tab.findViewById(R.id.bb_bottom_bar_icon); TextView title = (TextView) tab.findViewById(R.id.bb_bottom_bar_title); - if (!mIsShiftingMode || mIsTabletMode) { + if (mForceUseCustomActiveColor || !mIsShiftingMode || mIsTabletMode) { int inActiveColor = mIsDarkTheme ? mWhiteColor : mInActiveColor; icon.setColorFilter(inActiveColor);