Skip to content

StepApi

谷进杰 edited this page Jun 18, 2019 · 3 revisions

StepApi(分步RangeSeekBar API)

Preview

setSteps 设置步数

When steps > 1, it is will be step-by-step mode. 当步数大于1时会自动变为分步模式

//java
rangeSeekBar.setSteps(4);

//xml
app:rsb_steps="4"


setStepsWidth(float stepsWidth) 设置分步刻度的宽

set the step div view's width.

//java
rangeSeekBar.setStepsWidth(10f);

//xml
app:rsb_step_width="10dp"


setStepsHeight(float stepsHeight) 设置分步刻度的高

set the step div view's height.

//java
rangeSeekBar.setStepsHeight(10f);

//xml
app:rsb_step_height="10dp"


setStepsRadius(float stepsRadius) 设置分步刻度的圆角

set the step div view's radius.

//java
rangeSeekBar.setStepsRadius(10f);

//xml
app:rsb_step_radius="10dp"


setStepsColor(int stepsColor) 设置分步刻度的颜色

set the step div view's color.

//java
rangeSeekBar.setStepsColor(Color.WHITE);

//xml
app:rsb_step_color="@color/xxx"


setStepsDrawable 设置分步刻度的背景

set the step div view's background drawable. If you set this, the setStepsColor and setStepsRadius will not work.

//java
rangeSeekBar.setStepsDrawableId(@DrawableRes int stepsDrawableId);
rangeSeekBar.setStepsBitmaps(List<Bitmap> stepsBitmaps)
rangeSeekBar.setStepsDrawable(List<Integer> stepsDrawableIds)

//xml
app:rsb_step_drawable="@drawable/thumb_ghost"


setStepsAutoBonding 设置是否自动粘合

When thumb approaches the scale, it will automatically bond.当拇指接近刻度时,它会自动粘合。

//java
rangeSeekBar.setStepsAutoBonding(true);

//xml
app:rsb_step_auto_bonding="true"