一、简介
基于ViewPager的用户指引,广告图片Gallery,及自动轮播图片Gallery,使用起来超简单! GitHub地址:https://github.com/panxw/android-image-indicator
二、使用示例
1、广告图片Gallery
<com.allthelucky.common.view.ImageIndicatorView android:id="@+id/indicate_view" android:layout_width="match_parent" android:layout_height="160dp" />
代码:
imageIndicatorView = (ImageIndicatorView) findViewById(R.id.indicate_view); final Integer[] resArray = new Integer[] { R.drawable.ic_launcher, R.drawable.ic_launcher }; imageIndicatorView.setupLayoutByDrawable(resArray); imageIndicatorView.show();
2、自动轮播模式
<com.allthelucky.common.view.AutoImageIndicatorView android:id="@+id/auto_indicate_view" android:layout_width="match_parent" android:layout_height="160dp" />
autoImageIndicatorView = (AutoImageIndicatorView) findViewById(R.id.auto_indicate_view); final Integer[] resArray = new Integer[] { R.drawable.ic_launcher, R.drawable.ic_launcher }; autoImageIndicatorView.setBroadcastEnable(true); autoImageIndicatorView.setBroadCastTimes(5);//循环播放5次 autoImageIndicatorView.setBroadcastTimeIntevel(2 * 1000, 3 * 1000);//播放启动时间及间隔 autoImageIndicatorView.setupLayoutByDrawable(resArray);//图片 autoImageIndicatorView.show();
效果图:
3、用户指引模式
this.imageIndicatorView = (ImageIndicatorView) findViewById(R.id.guide_indicate_view); final Integer[] resArray = new Integer[] { R.drawable.ic_launcher, R.drawable.ic_launcher }; imageIndicatorView.setupLayoutByDrawable(resArray); imageIndicatorView.setIndicateStyle(ImageIndicatorView.INDICATE_USERGUIDE_STYLE); imageIndicatorView.show();
PS: 顺便宣传下自己的GitHub,https://github.com/ panxw , 欢迎来Follow~