Skip to content

Commit

Permalink
Set selected state so icons can also be highlighted when clicked with…
Browse files Browse the repository at this point in the history
… drawables.

Off counter by 1.
  • Loading branch information
rogerhu committed Feb 20, 2015
1 parent 3f4738e commit bb3c85d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion library/src/com/astuetz/PagerSlidingTabStrip.java
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,16 @@ protected void onDraw(Canvas canvas) {
// draw divider

dividerPaint.setColor(dividerColor);
for (int i = 0; i < tabCount - 1; i++) {
for (int i = 0; i < tabCount; i++) {
View tab = tabsContainer.getChildAt(i);

// set item to be selected
if (tab == currentTab) {
tab.setSelected(true);
} else {
tab.setSelected(false);
}

canvas.drawLine(tab.getRight(), dividerPadding, tab.getRight(), height - dividerPadding, dividerPaint);
}
}
Expand Down

0 comments on commit bb3c85d

Please # to comment.