学习笔记之RollPagerView
实现效果很棒
,相比较之前在使用ViewPager结合Hanlder的实现过程来讲,使用此控件更加便捷
,相比较之前在使用ViewPager结合Hanlder的实现过程来讲,使用此控件更加便捷使用步骤:
- 依赖
compile 'com.jude:rollviewpager:1.4.5' - 使用控件:
<com.jude.rollviewpager.RollPagerView android:id="@+id/mRpv" android:layout_width="match_parent" android:layout_height="match_parent"/>
3.绑定控件mRpv=(RollPagerView)findViewById(R.id.mRpv);
4.开始使用
//设置播放时间
mRpv.setPlayDelay(2500);
//设置图片切换时间
mRpv.setAnimationDurtion(800);
//设置适配器
mRpv.setAdapter(new MyAdapter());
//设置圆点指示器颜色
mRpv.setHintView(new ColorPointHintView(this, Color.YELLOW, Color.WHITE));4.1.适配器:
class MyAdapter extends StaticPagerAdapter {
private int[] imgs = {R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher};
@Override
public View getView(ViewGroup container, int position) {
ImageView imageView = new ImageView(container.getContext());
imageView.setImageResource(imgs[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return imageView;
}
@Override
public int getCount() {
return imgs.length;
}
}使用总结 :
其实使用来还是蛮简单的,没有什么上手难度,虽然有些方法参数什么的理解不是辣么的透彻,但胜在使用快捷
Ok就是这样。
本文介绍RollPagerView的使用方法及步骤,包括配置依赖、布局设置、初始化控件、设置播放时间与图片切换时间等,通过实例展示如何快速实现轮播效果。


被折叠的 条评论
为什么被折叠?



