1、具体步骤
说下大概实现步骤,一般我们有两种,一种是viewpager+作为游标的点 。另外一种是重写viewpager。
效果图:
1.1 布局,直接viewpager+一个viewgroup就好。
代码语言:javascript
1.2 动态add的点,常规白点:point_normal.xml。
代码语言:javascript
选中为红点: point_select.xml
代码语言:javascript
1.3动态添加进去图片和游标点。
代码语言:javascript
1.4 viewpgaer绑定PagerAdapter,这样就能滑动照片并且无限滑了。
代码语言:javascript
1.5 实现游标,就是滑动图片,下面的红点也跟着变化。
代码语言:javascript
1.6实现自动轮询。开启一个线程即可。
代码语言:javascript
runOnUiThread(new Runnable() {@Overridepublic void run() {vp_pager.setCurrentItem(vp_pager.getCurrentItem()+1);}});}}}
这样就搞定了,仅仅提供一个思路。自己可以扩展,例如重写viewpager,把功能封装在内部即可。