-
Notifications
You must be signed in to change notification settings - Fork 390
BaseApi
谷进杰 edited this page Jun 18, 2019
·
3 revisions
You should set SeekBarMode firstly. 你应该首先设置模式类型,选择单向还是范围
- SingleMode 单向 :
app:rsb_mode="single"
orrangeSeekBar.setSeekBarMode(RangeSeekBar.SEEKBAR_MODE_SINGLE)
- RangeMode 范围 :
app:rsb_mode="range"
orrangeSeekBar.setSeekBarMode(RangeSeekBar.SEEKBAR_MODE_RANGE)
set current RangeSeekBar progress 设置当前进度
- SingleMode 单向 :
rangeSeekBar.setProgress(10f)
- RangeMode 范围 :
rangeSeekBar.setProgress(10f, 30f)
get current RangeSeekBar progress 设置当前进度
- SingleMode 单向:
rangeSeekBar.leftSeekBar.getProgress()
- RangeMode 范围:
rangeSeekBar.leftSeekBar.getProgress()
andrangeSeekBar.rightSeekBar.getProgress()
Set the maximum and minimum values. 设置最大值和最小值
minInterval
is the minimum value between the two thumbs of RangeSeekBar. (minInterval
是RangeSeekBar两个按钮的最小间距值)
//java
rangeSeekBar.setRange(0f, 100f);
rangeSeekBar.setRange(0f, 100f, 30f);
//xml
app:rsb_min="0"
app:rsb_max="100"
app:rsb_min_interval="30"
Gravity.TOP | Gravity.CENTER | Gravity.BOTTOM
//java
rangeSeekBar.setGravity = RangeSeekBar.Gravity.CENTER;
//xml
app:rsb_gravity="center"
set custom fonts
//java
rangeSeekBar.setTypeface()
rangeSeekBar.setOnRangeChangedListener(new OnRangeChangedListener() {
@Override
public void onRangeChanged(RangeSeekBar view, float leftValue, float rightValue, boolean isFromUser) {
//leftValue is left seekbar value, rightValue is right seekbar value
}
@Override
public void onStartTrackingTouch(RangeSeekBar view, boolean isLeft) {
//start tracking touch
}
@Override
public void onStopTrackingTouch(RangeSeekBar view, boolean isLeft) {
//stop tracking touch
}
});