From 8fc7aded9e558952e242638063bbec8a83bc4459 Mon Sep 17 00:00:00 2001 From: abhilashlr Date: Thu, 29 Jan 2015 06:55:42 +0530 Subject: [PATCH] Update TabPageIndicator.java Tab Text gets truncated when adding lengthy text and wasn't working properly as expected. Changes: Line 100 and Line 165 (Commented). --- library/src/com/viewpagerindicator/TabPageIndicator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/src/com/viewpagerindicator/TabPageIndicator.java b/library/src/com/viewpagerindicator/TabPageIndicator.java index 1fceda3e0..5c5e0d909 100644 --- a/library/src/com/viewpagerindicator/TabPageIndicator.java +++ b/library/src/com/viewpagerindicator/TabPageIndicator.java @@ -98,11 +98,12 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int childCount = mTabLayout.getChildCount(); if (childCount > 1 && (widthMode == MeasureSpec.EXACTLY || widthMode == MeasureSpec.AT_MOST)) { - if (childCount > 2) { + /*if (childCount > 2) { mMaxTabWidth = (int)(MeasureSpec.getSize(widthMeasureSpec) * 0.4f); } else { mMaxTabWidth = MeasureSpec.getSize(widthMeasureSpec) / 2; - } + }*/ + mMaxTabWidth = MeasureSpec.getSize(widthMeasureSpec); } else { mMaxTabWidth = -1; } @@ -160,7 +161,8 @@ private void addTab(int index, CharSequence text, int iconResId) { tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0); } - mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1)); + //mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1)); + mTabLayout.addView(tabView, new LinearLayout.LayoutParams(WRAP_CONTENT, MATCH_PARENT, 1)); } @Override