public class BannerIndicatorView extends View {
public static final int INDICATOR_STYLE_CIRCLE = 0;
public static final int INDICATOR_STYLE_RECT = 1;
/*** 指示器中的总数**/
private int cellCount = 0;
/*** 当前选中的位置**/
private int currentPosition;
/*** 小点之间的间距*/
private int cellMarginSize = 10;
/*** 指示器元素的半径(注意是半径,不是直径)**/
private int cellRadius = 10;
/****未选中的颜色*/
private int normalColor;
/*** 选中的颜色**/
private int selectedColor;
/*** 小点的样式,默认是圆形*/
private int indicatorStyle = INDICATOR_STYLE_CIRCLE;
private Paint paint;
public BannerIndicatorView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
paint.setAntiAlias(true);
initAttrs(context, attrs);
}
private void initAttrs(Context context, @Nullable AttributeSet attrs) {
TypedArray t = context.obtainStyledAttributes(attrs, R.styleable.IndicatorView);
cellCount = t.getInt(R.styleable.IndicatorView_app_cell_count
自定义banner轮播图指示点
最新推荐文章于 2024-06-20 10:53:51 发布
本文详细介绍了如何为Banner轮播图定制独特的指示点,包括动态更新指示器状态、自定义样式以及与轮播图的交互逻辑,帮助开发者创建更具视觉吸引力的用户体验。
摘要由CSDN通过智能技术生成