
回复
IndicatorComponent
属性 | CIRCLE | DASH | ROUND_RECT |
---|---|---|---|
NORMAL | ![]() |
![]() |
![]() |
SMOOTH | ![]() |
![]() |
![]() |
WORM | ![]() |
![]() |
![]() |
COLOR | ![]() |
![]() |
![]() |
SCALE | ![]() |
![]() |
![]() |
在moudle级别下的build.gradle文件中添加依赖
Method | Description | Default |
---|---|---|
setOrientation(int) | 设置指示器的方向,可选值(INDICATOR_HORIZONTAL/INDICATOR_VERTICAL) | 默认值为INDICATOR_HORIZONTAL |
setIndicatorStyle(Int) | 设置指示器样式 | 枚举类型(CIRCLE;DASH;ROUND_RECT) 默认值:CIRCLE |
setSliderColor(normalColor: Int,selectedColor: Int) | 设置指示器滑块颜色 | normalColor:未选中时的滑块颜色, 默认值:"#8C18171C", checkedColor:选中时滑块颜色,默认值:"#6C6D72" |
setSlideMode(slideMode: Int) | 设置滑块滑动模式 | 枚举类型(NORMAL;SMOOTH;WORM;COLOR;SCALE),默认值:NORMAL |
setSliderWidth(indicatorWidth:Int) | 设置滑块宽度,如果是圆形指示器则为滑块直径 | 默认值:8dp |
setSliderWidth(normalWidth Int , checkWidth Int) | 设置滑块宽度,如果是圆形指示器则为滑块直径 | 默认值 8dp |
setIndicatorHeight(indicatorHeight Int) | 设置指示器高度,只有在DASH和ROUND_RECT样式下有效 | 默认值为:normalIndicatorWidth/2 |
setSliderGap(indicatorMargin Int ) | 设置滑块之间的间距 | 默认值为滑块宽度或者直径 |
setupWithViewPager(ViewPager) | indicator与ViewPager关联 |
一、IndicatorComponent
到目前为止IndicatorComponent已经可以支持三种indicator样式以及五种滑动样式,具体使用步骤如下:
1.在layout.xml文件中添加如下代码:
2.为IndicatorComponent配置参数:
二、自定义Indicator样式 DrawableIndicator
DrawableIndicator是一个自定义的Indicator,位于Sample中,使用DrawableIndicator可以设置bitmap drawable或者vector drawable,可以自定义drawable的大小,具体使用步骤如下:
Add IndicatorView in layout.xml
三、FigureIndicatorComponent
这是一个演示如何实现自定义指示器的例子,例子将实现一个如下图的indicator样式
Custom IndicatorView Style |
---|
![]() |
自定义Component并继承BaseIndicatorComponent
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
1.0.0