博客
关于我
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有哪些锁
查看>>
MySQL服务器安装(Linux)
查看>>
mysql服务器查询慢原因分析方法
查看>>
mysql服务无法启动的问题
查看>>
MySQL杂谈
查看>>
mysql权限
查看>>
mysql条件查询
查看>>
MySQL条件查询
查看>>
MySQL架构与SQL的执行流程_1
查看>>
MySQL架构与SQL的执行流程_2
查看>>
MySQL架构介绍
查看>>
MySQL架构优化
查看>>
mysql架构简介、及linux版的安装
查看>>
MySQL查看数据库相关信息
查看>>
MySQL查看表结构和表中数据
查看>>
MySQL查询优化:LIMIT 1避免全表扫描
查看>>
MySQL查询优化之索引
查看>>
mysql查询储存过程,函数,触发过程
查看>>
mysql查询总成绩的前3名学生信息
查看>>
mysql查询慢排查
查看>>