如何更改搜索栏拇指的颜色?拇指、如何更改、颜色

由网友(゛疯就要疯的够独特)分享简介:我在我的Andr​​oid应用程序的默认搜索栏。我注意到,当拇指在搜索栏举行,它变成黄色。相反,我希望它是举行,当它变成蓝色。如何才能做到这一点?我道歉,如果这是一个基本的问题,我是新的android开发。谢谢你。I have the default seekbar in my android app. I noti...

我在我的Andr​​oid应用程序的默认搜索栏。我注意到,当拇指搜索栏举行,它变成黄色。相反,我希望它是举行,当它变成蓝色。如何才能做到这一点?我道歉,如果这是一个基本的问题,我是新的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.

推荐答案

如果你不喜欢默认的拇指,你必须创建自己的Drawable,然后你可以设置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,你将要创建一个State名单可绘制 。

阅读全文

相关推荐

最新文章