问题描述
我用下面的库:
设置ViewPagerIndicator(TitlePageIndicator)
I'm using the following library:https://github.com/JakeWharton/Android-ViewPagerIndicatorto set a ViewPagerIndicator(TitlePageIndicator)
TitlePageIndicator titleIndicator = (TitlePageIndicator) findViewById(R.id.someId);
我很难codeD,字符串的声明数组
I have a hardcoded, declared array of String
private static final String[] CONTENT = new String[] { "#", "Home", "Icon" };
在我ViewPager适配器,我简单地设置选项卡的名称,像这样:
and in my ViewPager Adapter, I simply set the name of the tab like so:
public CharSequence getPageTitle(int position) {
return CONTENT[position % CONTENT.length].toUpperCase();
}
这一切工作正常。我的问题是 - 我可以改变标签标题到的图标的而不是文本的?这可能吗?如果没有,是否有我应该使用来实现这个任何其他工具?
This all works fine. My question is- can I change the tab "title" to an icon instead of text? Is this possible? If not, is there any other tool I should be using to achieve this?
我已经看过了股票的例子,我还没有看到类似的图标。
I have looked at the "stock" examples, and I have not seen something like an icon.
我们可以看到,。这是你想要的吗?
Take a look at the FixedIconTabs example from the ViewPageExtensions project 1. Is that what you want ?
- 的
编辑 - 添加图片
这篇关于更改ViewPagerIndicator到图标,而不是文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!