Skip to content

Commit 104eb72

Browse files
committed
fix LinePageIndicator #3
1 parent d24b9e3 commit 104eb72

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/src/main/java/net/cpacm/library/indicator/ViewpagerIndicator/LinePageIndicator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,10 @@ private int measureWidth(int measureSpec) {
368368
result = specSize;
369369
} else {
370370
//Calculate the width according the views count
371-
final int count = mViewPager.getAdapter().getCount();
371+
int count = mViewPager.getAdapter().getCount();
372+
if (mViewPager.getAdapter() instanceof InfinitePagerAdapter) {
373+
count = ((InfinitePagerAdapter) mViewPager.getAdapter()).getRealCount();
374+
}
372375
result = getPaddingLeft() + getPaddingRight() + (count * mLineWidth) + ((count - 1) * mGapWidth);
373376
//Respect AT_MOST value if that was what is called for by measureSpec
374377
if (specMode == MeasureSpec.AT_MOST) {

0 commit comments

Comments
 (0)