控件——SeekBar
2017-11-08 本文已影响0人
潇_夏
SeekBar是一个表示进度的控件。使用非常广泛,在xml中定义时有很多属性。
简介:
SeekBar控件在xml定义时常用到的属性。
android:max="":设置最大进度
android:progress="":设置当前进度
android:secondaryProgress="":设置第二进度
android:indeterminate="":设置是否为不明确进度进度条
android:thumb="":设置seekbar滑动快的图片
android:progressDrawable="":进度条背景图片
android:thumbTint="":滑动块颜色,API21以上才有效
android:thumbOffset="":两端不覆盖
使用:
1.android:progressDrawable=""
android:progressDrawable=""这个属性是在使用SeekBar时必然要用的属性。
我们可以在res/drawable/目录下创建一个xml文件。然后里面写:

然后在使用的时候:android:progressDrawable="@drawable/set_qcd_progress_red"
2.android:thumbOffset=""
在刚使用SeekBar的时候,我没写这个属性,于是出现SeekBar两端有部分被挡住的情况:



想要避免这个情况只需设置android:thumbOffset="0dp"就好了。