我有一个取景器,它使用PagerTabStrip来指示当前页面。但是,我不希望默认的指示符出现。(在页面标题下面下划线)
我尝试过几种不同的方法来去除它,但它们似乎都不起作用。
pts.setTabIndicatorColor(getResources().getColor(android.R.color.transparent));= ( PagerTabStrip ) findViewById(R.id.pager_title_strip)
也是
pts.setTabIndicatorColor(Color.parseColor("#80000000"));= ( PagerTabStrip ) findViewById(R.id.pager_title_strip)
和
PagerTabStrip pts = (PagerTabStrip) findViewById(R.id.pager_title_strip);pts.setTabIndicatorColor(Color.TRANSPARENT);
这些似乎都不起作用。相反,它给了我一个黑色的指示器。任何帮助都将不胜感激。谢谢!
发布于 2012-12-07 12:09:48
通过查看PagerTabStrip的来源。我发现了以下方法:
/**
* 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();
}我还没有测试过这个,但我认为这应该是可行的。如果没有,请留下评论。
发布于 2013-12-30 15:26:01
PagerTitleStrip是你所需要的。它具有相同的功能,只是没有下划线颜色。
发布于 2014-10-29 16:26:47
如果不想使用PagerTitleStrip,可以将指示器颜色设置为背景PagerTabStrip的相同颜色
https://stackoverflow.com/questions/13591306
复制相似问题