setProgressDrawable填充整个seekBar [英] setProgressDrawable fills the entire seekBar

查看:345
本文介绍了setProgressDrawable填充整个seekBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题中所述,当我使用setProgressDrawable时,它将填充整个SeekBar:如果进度为34%,则进度显示为100%,但是拇指显示正确的percentatge为34%.我不知道可能是什么问题...

As I say in the title, when I use setProgressDrawable, it fills the entire SeekBar: if progress is at 34%, progress show 100% but thumb shows the correct percentatge 34%. I don't figure out what can be the problem...

   done.setProgressDrawable(getResources().getDrawable(R.drawable.seekbar_progress));
   done.setThumb(getResources().getDrawable(R.drawable.seekbar_thumb));

seekbar_progress.xml

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

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标签内

try to put the fill shape inside a clip tag like so

<clip>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="15dp"    android:color="#52a8ec"/>
</clip>

这篇关于setProgressDrawable填充整个seekBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆