I have a viewpager that uses a PagerTabStrip to indicate the current page. However, I don't want the default indicator to be present. (Underline underneath the page title)
I've tried a few different methods to remove it, but none of them seem to work.
PagerTabStrip pts = (PagerTabStrip) findViewById(R.id.pager_title_strip); pts.setTabIndicatorColor(getResources().getColor(android.R.color.transparent));
also
PagerTabStrip pts = (PagerTabStrip) findViewById(R.id.pager_title_strip); pts.setTabIndicatorColor(Color.parseColor("#80000000"));
and
PagerTabStrip pts = (PagerTabStrip) findViewById(R.id.pager_title_strip); pts.setTabIndicatorColor(Color.TRANSPARENT);
None of these seems to work. Instead it gives me a black indicator instead. Any help would be appreciated. THanks!
By looking at the source of PagerTabStrip. I have found the following method:
/**
* Set whether this tab strip should draw a full-width underline in the
* current tab indicator color.
*
* @param drawFull true to draw a full-width underline, false otherwise
*/
public void setDrawFullUnderline(boolean drawFull) {
mDrawFullUnderline = drawFull;
mDrawFullUnderlineSet = true;
invalidate();
}
I have not tested this, but I suppose this should work. Leave a comment if it doesn't.
PagerTitleStrip is what you need. It has the same functionality, just without the underline color.
If you don't want use PagerTitleStrip, you can set the Indicator Color to same color of Background PagerTabStrip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With