From bb3c85db1602709fdc87886e5f8dfe4fe6b492ee Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Fri, 20 Feb 2015 01:46:34 -0800 Subject: [PATCH] Set selected state so icons can also be highlighted when clicked with drawables. Off counter by 1. --- library/src/com/astuetz/PagerSlidingTabStrip.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/src/com/astuetz/PagerSlidingTabStrip.java b/library/src/com/astuetz/PagerSlidingTabStrip.java index 87b671c..da7cbc1 100644 --- a/library/src/com/astuetz/PagerSlidingTabStrip.java +++ b/library/src/com/astuetz/PagerSlidingTabStrip.java @@ -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); } }