之前封装过一个,但总觉得不够优雅,就有了这个通用封装,很简洁,不知道够不够优雅,不过原来那个有跟随指示器和丝滑滑动效果,感兴趣可以看一下。

封装过程
1、自定义属性
selectPoint:选中指示器图标
normalPoint:未选中指示器图标
pointWidth:图标宽度
switchTime:轮播间隔事件
location:指示器位置,下中或下右
<declare-styleable name="NewBannerView">
<attr name="selectPoint" format="reference" />
<attr name="normalPoint" format="reference" />
<attr name="pointWidth" format="dimension" />
<attr name="switchTime" format="integer" />
<attr name="location">
<enum name="CENTER" value="0" />
<enum name="RIGHT" value="1" />
</attr>
</declare-styleable>