Discre
te SeekBar是一个Ma
terial Design风格的、带有气泡指示器的拖动条。可以
自定义 样式,非常不错的东西。项目地址:https://github.com/AnderWeb/
discre
te SeekBar效果图:使用起来也非常简单如何使用xml中创建<org.adw.library.widgets.
discre
te seekbar.
Discre
te SeekBarandroid
:id="@ id/
discre
te"
android
:layout_width="match_parent"
android
:layout_height="wrap_con
tent"
app:dsb_min="1"
app:dsb_max="100"
app:dsb_value="20"
app:dsb_indicatorFormat
ter="d"
/>2. java
Discre
te SeekBardis
cre
te SeekBar= (
Discre
te SeekBar) findViewById(R.id.
discre
te);
//设置浮动气泡的值,每次进度值改变时,都会触发
discre
te SeekBar.setNumericTransformer(new
Discre
te SeekBar.NumericTransformer() {
@Override
public int transform(int value) {
return value * 10;
}
});
//进度值变化监听
discre
te SeekBar.setOn
ProgressChangeLis
tener(new
Discre
te SeekBar.On
ProgressChangeLis
tener(){
public void on
ProgressChanged(
Discre
te SeekBarseekBar
, int value, boolean fromUser){
}
public void onStartTrackingTouch(
Discre
te SeekBarseekBar
){
}
public void onStopTrackingTouch(
Discre
te SeekBarseekBar
){
}
});属性说明属性名类型使用说明dsb_minin
teger|dimension最小进度值dsb_maxin
teger|dimension最大进度值dsb_valuein
teger|dimension当前进度值dsb_mirrorForRtlboolean由于某些语言,比如阿拉伯语、希伯来语,是“从右往左”显示的,和中文、英语……是相反的。所以该属性的含义是,是否根据本地语言进行反向。dsb_allowTrackClickToDragboolean是否允许通过点击进度条上某一点,来改变进度值。默认是truedsb_
progressColorcolor|reference设置进度条及滑块(thumb)的颜色dsb_trackColorcolor|reference设置背景条(track)的颜色dsb_indicator
TextAppearancereference设置气泡(bubble)的
样式dsb_indicatorColorcolor|reference设置气泡(bubble)的背景色dsb_indicatorElevationdimension很抱歉,这个属性我也不知道怎么用。rela
ted to
android:elevation. Will only be used on API level 21 dsb_indicatorFormat
terstring|reference设置气泡指示器文字的格式dsb_rippleColorcolor|reference设置触碰点波动的颜色dsb_indicatorPopupEnabledboolean是否显示气泡指示器
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.mushiming.com/mjsbk/6741.html