-
Notifications
You must be signed in to change notification settings - Fork 396
IndicatorApi
The indicator is belong to RangeSeekBar.leftSeekBar
and RangeSeekBar.rightSeekBar
. You can set a different style for each SeekBar.
指示器是属于RangeSeekBar.leftSeekBar
和 RangeSeekBar.rightSeekBar
的,所以你可以为它们设置不同的样式。
If you want to use the indicator, you need to set the app:rsb_indicator_show_mode
first.
Options: showWhenTouch
|alwaysHide
| alwaysShowAfterTouch
| alwaysShow
The indicator‘s height and width also supports wrap_content
.
//xml
app:rsb_indicator_width="40dp"
app:rsb_indicator_height="40dp"
-
setIndicatorTextDecimalFormat(String format)
Format decimal places. 格式化小数位数 -
setIndicatorTextStringFormat(String format)
Format string text. 格式化字符串
Examples 示例
Example-1:
rangeSeekBar.setIndicatorTextDecimalFormat("0");
original text
: "7.69"formated
: "7"
Example-2:
rangeSeekBar.getLeftSeekBar().setIndicatorTextDecimalFormat("0.0");
rangeSeekBar.getLeftSeekBar().setIndicatorTextStringFormat("%s%%");
original text
: "7.69"formated
: "7.6%"
The indicator‘s margin is between the thumb and the indicator.
//xml
app:rsb_indicator_margin="10dp"
The indicator‘s padding is between the text and the indicator.
//xml
app:rsb_indicator_padding_left="10dp"
app:rsb_indicator_padding_right="10dp"
app:rsb_indicator_padding_top="10dp"
app:rsb_indicator_padding_bottom="10dp"
In order to ensure the adaptation effect, it is recommended to use the 9patch
file.
为了保证适配效果,建议使用9patch
//java
rangeSeekBar.leftSeekBar.setIndicatorDrawableId()
//xml
app:rsb_indicator_drawable="@drawable/xxx"
//java
rangeSeekBar.leftSeekBar.setIndicatorBackgroundColor()
//xml
app:rsb_indicator_background_color="@color/xxx"
//java
rangeSeekBar.leftSeekBar.setIndicatorRadius()
//xml
app:rsb_indicator_radius="10dp"
//java
rangeSeekBar.leftSeekBar.setIndicatorTextSize(sp2px(10))
//xml
app:rsb_indicator_text_size="10sp"
//java
rangeSeekBar.leftSeekBar.setIndicatorTextColor()
//xml
app:rsb_indicator_text_color="@color/xxx"
if you set the indicator background by drawable, this attr will not work. 如果你使用了drawable作为指示器背景,那么此属性则不会生效
//java
rangeSeekBar.leftSeekBar.setIndicatorArrowSize()
//xml
app:rsb_indicator_arrow_size="5dp"