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 49c981df..bbd0da0b 100644 --- a/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java +++ b/bottom-bar/src/main/java/com/roughike/bottombar/BottomBar.java @@ -83,6 +83,7 @@ public class BottomBar extends RelativeLayout implements View.OnClickListener, V private Integer mPrimaryColor; private Integer mInActiveColor; + private Integer mInActiveTextColor; private Integer mDarkBackgroundColor; private Integer mWhiteColor; private float mTabAlpha = 0.6f; @@ -690,6 +691,23 @@ public void setFixedInactiveIconColor(int iconColor) { } } + /** + * Set a custom color for inactive text in fixed mode. + *

+ * NOTE: This value is ignored if not in fixed mode. + * + * @param textColor a hex color used for icons, such as 0xFF00FF00. + */ + public void setFixedInactiveTextColor(int textColor) { + mInActiveTextColor = textColor; + + if (mItems != null && mItems.length > 0) { + throw new UnsupportedOperationException("This BottomBar " + + "already has items! You must call setFixedInactiveTextColor() " + + "before setting any items."); + } + } + /** * Set a custom color for icons in shifting mode. *

@@ -1552,11 +1570,16 @@ private void unselectTab(View tab, boolean animate) { TextView title = (TextView) tab.findViewById(R.id.bb_bottom_bar_title); if (!mIsShiftingMode || mIsTabletMode) { - int inActiveColor = mIsDarkTheme ? mWhiteColor : mInActiveColor; - icon.setColorFilter(inActiveColor); + Integer inActiveColor = mIsDarkTheme ? mWhiteColor : mInActiveColor; + if (inActiveColor == null) { + icon.clearColorFilter(); + } else { + icon.setColorFilter(inActiveColor); + } if (title != null) { - title.setTextColor(inActiveColor); + int inActiveTextColor = mInActiveTextColor == null ? inActiveColor : mInActiveTextColor; + title.setTextColor(inActiveTextColor); } }