# AlphaIndicatorView **Repository Path**: wu4321/AlphaIndicatorView ## Basic Information - **Project Name**: AlphaIndicatorView - **Description**: 仿微信底部tab标签,滑动的时候颜色渐变,使用极其简单,只需要两行代码。 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-05-23 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AlphaIndicatorView ### 仿微信底部tab标签,滑动的时候颜色渐变,使用极其简单,只需要两行代码。 欢迎大家下载体验本项目,如果使用过程中遇到什么问题,欢迎反馈。 ### 联系方式 * 邮箱地址: liaojeason@126.com * QQ群: 489873144 (建议使用QQ群,邮箱使用较少,可能看的不及时) * 本群刚建立,旨在为使用我的github项目的人提供方便,如果遇到问题欢迎在群里提问。个人能力也有限,希望一起学习一起进步。 ## 演示 ![image](https://github.com/jeasonlzy0216/AlphaIndicatorView/blob/master/screenshots/demo1.gif)![image](https://github.com/jeasonlzy0216/AlphaIndicatorView/blob/master/screenshots/demo2.png)![image](https://github.com/jeasonlzy0216/AlphaIndicatorView/blob/master/screenshots/demo3.png) ## 1.用法 该项目和我github上其他的view相关的项目已经一起打包上传到jCenter仓库中(源码地址 [https://github.com/jeasonlzy0216/ViewCore](https://github.com/jeasonlzy0216/ViewCore) ),使用的时候可以直接使用compile依赖,用法如下 ```java compile 'com.lzy.widget:view-core:0.1.5' ``` 或者使用 ```java compile project(':alphaview') ``` ## 注意事项 该项目可以自动判断每一个Tab中的View,是否具有图标和文字,允许出现以下三种情况: * 自定义属性只设置了 tabText ,表示只有文字,滑动时文字颜色渐变过度 * 自定义属性只设置了 tabIconNormal 和 tabIconSelected ,表示只有图标,滑动时图标颜色渐变过度 * 以上两种都设置了,表示文字和图标同时渐变过度 ## 功能和参数含义
配置参数 参数含义
tabIconNormal 未选中的图标
tabIconSelected 已经选中的图标
tabText tab标签的文字
tabTextSize tab标签的文字大小
textColorNormal 未选中的文字颜色
textColorSelected 已选中的文字颜色
## 3.代码参考 ### 1.在Activity中做如下初始化,只需要找到控件并且设置ViewPager即可完成。 ```java protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager); viewPager.setAdapter(new MainAdapter(getSupportFragmentManager())); AlphaIndicator alphaIndicator = (AlphaIndicator) findViewById(R.id.alphaIndicator); alphaIndicator.setViewPager(viewPager); } ``` ### 2.布局文件 ```xml ```