Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Update TabPageIndicator.java #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions library/src/com/viewpagerindicator/TabPageIndicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down