Fix Tabs not filling correctly in FIXED mode

Caused by using the wrong measure spec mode.

BUG: 25296491
Change-Id: I0cc508feb159abe1659072f27d3b4f53565f68b9
diff --git a/design/src/android/support/design/widget/TabLayout.java b/design/src/android/support/design/widget/TabLayout.java
index 654936b..d42108d 100755
--- a/design/src/android/support/design/widget/TabLayout.java
+++ b/design/src/android/support/design/widget/TabLayout.java
@@ -1224,19 +1224,27 @@
         }
 
         @Override
-        public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-            final int specWidth = MeasureSpec.getSize(widthMeasureSpec);
+        public void onMeasure(final int origWidthMeasureSpec, final int origHeightMeasureSpec) {
+            final int specWidthSize = MeasureSpec.getSize(origWidthMeasureSpec);
+            final int specWidthMode = MeasureSpec.getMode(origWidthMeasureSpec);
             final int maxWidth = getTabMaxWidth();
-            if (maxWidth > 0 && (specWidth == 0 || specWidth > maxWidth)) {
-                // If we have a max width and a given spec size which is either unspecified or
-                // larger than the spec size, use a AT_MOST spec
-                super.onMeasure(MeasureSpec.makeMeasureSpec(mTabMaxWidth, MeasureSpec.AT_MOST),
-                        heightMeasureSpec);
+
+            final int widthMeasureSpec;
+            final int heightMeasureSpec = origHeightMeasureSpec;
+
+            if (maxWidth > 0 && (specWidthMode == MeasureSpec.UNSPECIFIED
+                    || specWidthSize > maxWidth)) {
+                // If we have a max width and a given spec which is either unspecified or
+                // larger than the max width, update the width spec using the same mode
+                widthMeasureSpec = MeasureSpec.makeMeasureSpec(mTabMaxWidth, specWidthMode);
             } else {
-                // Else, use the original specs
-                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+                // Else, use the original width spec
+                widthMeasureSpec = origWidthMeasureSpec;
             }
 
+            // Now lets measure
+            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+
             // We need to switch the text size based on whether the text is spanning 2 lines or not
             if (mTextView != null) {
                 final Resources res = getResources();