如何更改搜索栏拇指的颜色? [英] How to change colour of the thumb in seekbar?
问题描述
我在我的Android应用程序的默认搜索栏
。我注意到,当拇指
在搜索栏
举行,它变成黄色。相反,我希望它是举行,当它变成蓝色。如何才能做到这一点?我道歉,如果这是一个基本的问题,我是新的android开发。谢谢你。
I have the default seekbar
in my android app. I noticed that when the thumb
on the seekbar
is held, it turns yellow. Instead, I want it to turn blue when it is held. How can this be done? I apologize if this is a basic question, I am new to android development. Thanks.
推荐答案
如果你不喜欢默认的拇指,你必须创建自己的<一个href=\"http://developer.android.com/guide/topics/resources/drawable-resource.html\"><$c$c>Drawable$c$c>,然后你可以设置code拇指的东西,如:
If you don't like the default thumb, you will have to create your own Drawable
, which you can then set the thumb in code with something like:
Drawable thumb = getResources().getDrawable( R.drawable.myThumb );
SeekBar mSeekBar = (SeekBar) findViewById(R.id.mySeekBar);
mSeekbar.setThumb(thumb);
或者你也可以用设置拇指XML:
Or you can set the thumb in XML with:
<SeekBar
...
android:thumb="@drawable/seek_thumb" />
实际的绘制对象可以是图像,形状或任何其他种类的可绘制的你可能愿望。如果你想拇指改变外观,当它是pressed,你将要创建一个<一个href=\"http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList\"><$c$c>State名单可绘制 。
这篇关于如何更改搜索栏拇指的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!