Skip to content

Commit b48195c

Browse files
committed
Merge branch 'dev' of github.com:JakeWharton/Android-ViewPagerIndicator into dev
2 parents 779932b + 63fee36 commit b48195c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/src/com/viewpagerindicator/TitlePageIndicator.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,17 @@ protected void onDraw(Canvas canvas) {
435435
//Fade out/in unselected text as the selected text fades in/out
436436
mPaintText.setAlpha(colorTextAlpha - (int)(colorTextAlpha * selectedPercent));
437437
}
438+
439+
//Except if there's an intersection with the right view
440+
if (i < boundsSize - 1) {
441+
Rect rightBound = bounds.get(i + 1);
442+
//Intersection
443+
if (bound.right + mTitlePadding > rightBound.left) {
444+
int w = bound.right - bound.left;
445+
bound.left = (int) (rightBound.left - w - mTitlePadding);
446+
bound.right = bound.left + w;
447+
}
448+
}
438449
canvas.drawText(pageTitle, 0, pageTitle.length(), bound.left, bound.bottom + mTopPadding, mPaintText);
439450

440451
//If we are within the selected bounds draw the selected text

0 commit comments

Comments
 (0)