PageIndicatorView
PageIndicatorView
PageIndicatorView
PageIndicatorView
will simplify your life while you working with Android ViewPager
and need to indicate selected page. It's easy to setup and customize as you need with run-time preview rendering.
Integration
To add pageindicatorview
to your project, first make sure in root build.gradle
you have specified the following repository:
repositories {jcenter()}
Note: by creating new project in Android Studio it will have jcenter
repository specified by default, so you will not need to add it manually.
Once you make sure you have jcenter
repository in your project, all you need to do is to add the following line independencies
section of your project build.gradle
.
See latest library version
compile 'com.romandanylyk:pageindicatorview:X.X.X'
Keep in mind, that PageIndicatorView
has min API level 14
Usage Sample
During implementation of PageIndicatorView
I tried to make it's setup as easy as possible. After you set adapter to your ViewPager
, all you need to do is to setViewPager()
and that's it! PageIndicatorView
will get count from your adapter and start working with instance of your ViewPager
automatically.
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(adapter);
//instance of android.support.v4.view.PagerAdapter adapterPageIndicatorView pageIndicatorView = (PageIndicatorView) view.findViewById(R.id.pageIndicatorView);
pageIndicatorView.setViewPager(viewPager);
Keep in mind that all public methods are also exist as attributes, so you can even setup and customize page indicator without any java code.
<com.rd.PageIndicatorViewandroid:id="@+id/pageIndicatorView"android:layout_width="wrap_content"android:layout_height="wrap_content"attrs:piv_viewPager="@id/viewPager"/>
Customization
One of the most important feature of every custom view is ability to customize its look as user need. By calling the following methods (or attributes) you will be able to customize PageIndicatorView
as you need.
//set size
setCount(int count)
setDynamicCount(boolean dynamicCount)setRadius(int radiusDp)
setPadding(int paddingDp)//set color
setUnselectedColor(int color)
setSelectedColor(int color)//set animation
setAnimationDuration(long duration)
setAnimationType(AnimationType type)
setInteractiveAnimation(boolean isInteractive)//set selection
setProgress(int selectingPosition, float progress)
setSelection(int position)
Here you can see all the animations PageIndicatorView
support.
Name | Support version | Preview |
---|---|---|
AnimationType.NONE
|
0.0.1 | |
AnimationType.COLOR
|
0.0.1 | |
AnimationType.SCALE
|
0.0.1 | |
AnimationType.SLIDE
|
0.0.1 | |
AnimationType.WORM
|
0.0.1 |
Release Note
See release notes on github releases or Bintray release notes.
PageIndicatorView相关推荐
- 最新最全的 Android 开源项目合集(一)
原文链接:https://github.com/opendigg/awesome-github-android-ui 抽屉菜单 MaterialDrawer ★7337 - 安卓抽屉效果实现方案 Si ...
- [Android Pro] AndroidX重构和映射
原文地址:https://developer.android.com/topic/libraries/support-library/refactor https://blog.csdn.net/ch ...
- Android 开源优秀 Library 推荐
之后的每月会推荐一些优秀的开源 Android libraries,不仅仅是学习,也可以方便的使用到项目中,避免重复的造轮子. PageIndicatorView 如果你需要在 ViewPager 中 ...
- Android开发技术周报 Issue#101
新闻 [视频]Android版Google Assistant已流出:体验方法如下 Android 7.1 Nougat正式版定于今年12月到来 教程 理解Android进程启动之全过程 Androi ...
- GitHub 上受欢迎的 Android UI Library 整理(一)
内容较多,可以用 ctrl+F 来搜索 抽屉菜单 https://github.com/mikepenz/MaterialDrawer ★7337 - 安卓抽屉效果实现方案 https://githu ...
- Github常用框架集合
Script桥接 https://github.com/JackyAndroid/AndroidChromium ★1476 - 谷歌浏览器安卓版源码项目 https://github.com/The ...
- GitHub 上受欢迎的 Android UI Library 整理
抽屉菜单 https://github.com/mikepenz/MaterialDrawer ★7337 - 安卓抽屉效果实现方案 https://github.com/Yalantis/Side- ...
- GitHub 上受欢迎的 Android UI Library(part_one)
抽屉菜单 https://github.com/mikepenz/MaterialDrawer ★7337 - 安卓抽屉效果实现方案 https://github.com/Yalantis/Side- ...
- 最新最全的Android开源项目集合(转)
抽屉菜单 MaterialDrawer ★7337 - 安卓抽屉效果实现方案 Side-Menu.Android ★3865 - 创意边侧菜单 FlowingDrawer ★1744 - 向右滑动流动 ...
最新文章
- DateEdit如果开启Vista模式并显示日期+时间模式
- Win10中VMware14安装CentOS7详细步骤
- 【已解决】查看Python中已经安装的包
- 虚拟现实大潮渐近:Oculus VR、EA和Avegant等多家公司...
- asp ado 连接测试_ASP.NET Core 简介
- 七牛云异步抓取java_带你玩转七牛云存储——高级篇
- 电脑用电量_为什么换了智能电表后,我家用电量一下子多了这么多呢?
- optistruct线性求解一次二次单元应力位移比较
- udp java 实例_udp例子,javaudp简单实例分享
- NI MultiSim 正版软件的下载链接
- 戴尔服务器系统备份还原工具,DELL备份恢复系统的小工具 Dell DataSafe Local Backup[网络技术]...
- 如何使用手机打开CAJ文件?
- 网站分析-网站流量分析
- js将金额转为大写汉字
- X Lossless Decoder for mac(XLD无损音频转码软件)
- java 验证手机号码、电话号码(包括最新的电信、联通和移动号码) 1
- Driller源码阅读笔记(二)
- 利用Redis原子计数器incr实现计数器及接口限流
- 上位机.net大佬博客大全-菜鸟学习上位机C#那些事儿
- 第一行代码——第十三章:继续进阶——你还应该掌握的高级技巧