正如我在标题中所说,当我使用 setProgressDrawable 时,它会填满整个 SeekBar:如果进度为 34%,则进度显示 100%,但拇指显示正确的百分比为 34%。我不知道可能是什么问题...
done.setProgressDrawable(getResources().getDrawable(R.drawable.seekbar_progress));
done.setThumb(getResources().getDrawable(R.drawable.seekbar_thumb));
seekbar_progress.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="15dp" android:color="#52a8ec"/>
seekbar_thumb.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#ffffffff" android:endColor="#ff585858" android:angle="270"/>
<size android:height="17dp" android:width="5dp"/>
</shape>
有什么想法吗?
提前致谢!
最佳答案
尝试像这样将填充形状放入剪辑标签中
<clip>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="15dp" android:color="#52a8ec"/>
</clip>
关于android - setProgressDrawable 填充整个seekBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10161992/