一个ViewPager的页面切换指示控件
2016-10-26 10:17
260 查看
运行效果:
使用说明:
依赖:compile 'com.romandanylyk:pageindicatorview:X.X.X'
把xxx替换成版本号,最新版本0.0.4.
定义PageIndicatorView
<com.rd.PageIndicatorView
android:id="@+id/pageIndicatorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
attrs:viewPager="@id/viewPager"/>
设置ViewPager
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(adapter);
//instance of android.support.v4.view.PagerAdapter adapter
PageIndicatorView pageIndicatorView = (PageIndicatorView) view.findViewById(R.id.pageIndicatorView);
pageIndicatorView.setViewPager(viewPager);
自定义
//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)
下面是PageIndicatorView支持的所有动画效果。
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 |
相关代码
ParallaxPagerTransformer
DragTopLayout
freepager
MultiViewPager
MaterialViewPager
下载地址:https://github.com/romandanylyk/PageIndicatorView
相关文章推荐
- Multiple-View ViewPager-如何实现Viewpager控件的一个页面展示多个page以及回弹效果
- 【控件篇】ViewPager+FragmentStatePagerAdapter 页面切换案例详解
- Android ViewPager多页面滑动切换以及动画效果
- Android ViewPager多页面滑动切换以及动画效果
- Android ViewPager多页面滑动切换以及动画效果
- Android ViewPager多页面滑动切换以及动画效果
- UIPageControl + UIScrollView 创建一个页面指示器控件
- ViewPager多页面滑动切换以及动画效果
- ViewPager实现页面切换
- Android ViewPager 实现多个页面切换滑动
- ViewPager实现页面切换
- Android ViewPager多页面滑动切换以及动画效果
- ViewPager多页面滑动切换以及动画效果 (转载)
- ViewPager多页面滑动切换以及动画效果(转)
- ViewPager多页面滑动切换以及动画效果
- ViewPager多页面滑动切换以及动画效果
- ViewPager多页面滑动切换以及动画效果
- ViewPager实现多页面切换以及动画效果
- Android ViewPager多页面滑动切换以及动画效果
- ViewPager多页面滑动切换以及动画效果(转)