博客
关于我
TabPagerIndicator使用
阅读量:486 次
发布时间:2019-03-07

本文共 1433 字,大约阅读时间需要 4 分钟。

敲打1 注意/在清单文件中配置activity/theme=

android:theme="@style/Theme.PageIndicatorDefaults">

//吐舌头2   (adpter中添加getPageTitle)

//1.给viewPager设置数据适配器        MyPagerAdapter myPagerAdapter = new MyPagerAdapter();        pager.setAdapter(myPagerAdapter);        //2.指示器和viewPager进行绑定        indicator.setViewPager(pager);

3 重点(修改选中文字的颜色,背景)生气values/style/tabPageIndicator

@android:color/transparent 为加背景,,不能用@null

<item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>//这里

</style>

<style name="Widget"> </style> <style name="Widget.TabPageIndicator" parent="Widget"> <item name="android:gravity">center</item>
<item name="android:background">@drawable/vpi__tab_indicator</item>//背景
<item name="android:paddingLeft">22dip</item> <item name="android:paddingRight">22dip</item> <item name="android:paddingTop">12dp</item> <item name="android:paddingBottom">12dp</item> <item name="android:textAppearance">@style/TextAppearance.TabPageIndicator</item> <item name="android:textSize">12sp</item> <item name="android:maxLines">1</item> </style> <style name="TextAppearance.TabPageIndicator" parent="Widget"> <item name="android:textStyle">bold</item>
<item name="android:textColor">@color/vpi__dark_theme</item>//文字颜色
</style> <style name="Widget.IconPageIndicator" parent="Widget"> <item name="android:layout_marginLeft">6dp</item> <item name="android:layout_marginRight">6dp</item> </style></resources>

你可能感兴趣的文章
mysql_secure_installation初始化数据库报Access denied
查看>>
MySQL_西安11月销售昨日未上架的产品_20161212
查看>>
Mysql——深入浅出InnoDB底层原理
查看>>
MySQL“被动”性能优化汇总
查看>>
MySQL、HBase 和 Elasticsearch:特点与区别详解
查看>>
MySQL、Redis高频面试题汇总
查看>>
MYSQL、SQL Server、Oracle数据库排序空值null问题及其解决办法
查看>>
mysql一个字段为空时使用另一个字段排序
查看>>
MySQL一个表A中多个字段关联了表B的ID,如何关联查询?
查看>>
MYSQL一直显示正在启动
查看>>
MySQL一站到底!华为首发MySQL进阶宝典,基础+优化+源码+架构+实战五飞
查看>>
MySQL万字总结!超详细!
查看>>
Mysql下载以及安装(新手入门,超详细)
查看>>
MySQL不会性能调优?看看这份清华架构师编写的MySQL性能优化手册吧
查看>>