Allow setting the Tab Indicator at runtime
BUG: 21538661
Change-Id: I296857a3ba445e40a10848de24c71e437b2c5998
diff --git a/design/api/current.txt b/design/api/current.txt
index 8009a89..fd25afc 100644
--- a/design/api/current.txt
+++ b/design/api/current.txt
@@ -268,6 +268,8 @@
method public void removeTabAt(int);
method public void setOnTabSelectedListener(android.support.design.widget.TabLayout.OnTabSelectedListener);
method public void setScrollPosition(int, float, boolean);
+ method public void setSelectedTabIndicatorColor(int);
+ method public void setSelectedTabIndicatorHeight(int);
method public void setTabGravity(int);
method public void setTabMode(int);
method public void setTabTextColors(android.content.res.ColorStateList);
diff --git a/design/src/android/support/design/widget/TabLayout.java b/design/src/android/support/design/widget/TabLayout.java
index 35a5552..999dc00 100755
--- a/design/src/android/support/design/widget/TabLayout.java
+++ b/design/src/android/support/design/widget/TabLayout.java
@@ -24,6 +24,7 @@
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Build;
+import android.support.annotation.ColorInt;
import android.support.annotation.IntDef;
import android.support.design.R;
import android.support.v4.view.GravityCompat;
@@ -278,6 +279,24 @@
}
/**
+ * Sets the tab indicator's color for the currently selected tab.
+ *
+ * @param color color to use for the indicator
+ */
+ public void setSelectedTabIndicatorColor(@ColorInt int color) {
+ mTabStrip.setSelectedIndicatorColor(color);
+ }
+
+ /**
+ * Sets the tab indicator's height for the currently selected tab.
+ *
+ * @param height height to use for the indicator in pixels
+ */
+ public void setSelectedTabIndicatorHeight(int height) {
+ mTabStrip.setSelectedIndicatorHeight(height);
+ }
+
+ /**
* Set the scroll position of the tabs. This is useful for when the tabs are being displayed as
* part of a scrolling container such as {@link android.support.v4.view.ViewPager}.
* <p>