课程/Android/移动开发
不一样的自定义实现轮播图效果
-
-
草根灬小马
2017-05-11
- 1
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- ***还是出现异常,原因是在MainActivity当中也要去设置监听器:mGroup.setListener(this);
这样就可以将click的事件从ImageBarnnerViewGroup传递到MainActivity当中
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- ***依然出现空指针异常,问题是在初始化ImageBarnnerViewGroup的时候没有去设置监听器:imageBarnnerViewGroup.setListener(this);
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- ***然后实现接口里面的方法即可。
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- **此时就应该让MainActivity来实现FramLayoutListener接口而不是ImageBarnnerListener接口
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- 此时将传过来的参数pos传递给FramLayoutListener接口变量的方法中。
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- ***定义FrameLayoutListener接口变量并设置setter和getter方法
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- ***如果想把clickImageIndex传递给MainActivity的话,还需要在这里新创建一个接口,
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- 所以在ImageBarnnerFramLayout当中也要去实现ImagerBarnnerListener接口中的方法。
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- !!!
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- 当点击的时候就会把点击事件给到了我们定义的listener。
-
截图
0赞 · 0采集
-
-
最後的最後_
2017-04-02
- bug:当点击图片的任意一张,就会出现程序崩溃的情况。
-
截图
0赞 · 0采集