我试图使用JakeWharton
/ Android-ViewPagerIndicator
在选项卡中添加一个新条目的指示器(显示有新内容的小徽章)。
我从库中扩展了PageIndicator
并创建了自定义CustomPageIndicator
。我从TabPageIndicator
复制的大部分东西。我刚刚更改了在addTab方法中返回的视图。此视图是从xml中膨胀的。
当我运行应用程序时,从CustomPageIndicator
创建的指示器没有任何样式设置。应用程序中的所有其他指示器都很好。
我尝试将样式和背景设置为我的自定义xml布局的ViewPagerIndicator
视图和根视图。结果很糟糕。我得到了一些颜色,但高亮不起作用等。
代码:
它的外观:
那么,我需要添加什么才能在我的自定义指示器上获得样式呢?
发布于 2013-02-07 08:02:50
好的,我让它在github上的这个主题的帮助下工作。https://github.com/JakeWharton/Android-ViewPagerIndicator/issues/94
我所做的改变:
-Added --对CustomTabView的一个不同的超级调用(这是我膨胀的XML格式的视图)
super(context, null,com.viewpagerindicator.R.attr.vpiTabPageIndicatorStyle);
-Changed CustomPageIndicator(上下文上下文,AttributeSet吸引人)构造函数中的超级调用
super(new ContextThemeWrapper(context,R.style.Theme_VPI), attrs);
R.style.Theme_VPI是我的style.xml中定义的自定义主题。
<style name="Theme.VPI" parent="Theme.abstyle">
<item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item>
</style>
https://stackoverflow.com/questions/14706501
复制相似问题