请参阅View dev doc。 SeekBar派生自视图,您应该尝试在xml定义中使用具有Shape Drawable(纯色)的android:background
修改背景,或者使用setBackgroundColor以编程方式更改颜色。
要删除颜色,应该尝试将其设置为纯粹的透明颜色。
我没有测试过,所以让我们知道如果失败会发生什么。
更新
你可以试试:
定义res/drawable/white_bg.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
将搜索栏android:background="@drawable/white_bg"
给它先用纯白色的颜色一试,看看如果这是一个好的开始...
好吧,这是行不通的。
最后更新
好了,从那里我已经定制了ProgessBar我的一个项目得到了它。由于搜索栏从进度派生,你需要定义一个res/drawable/seekbar_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="270"/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<solid android:color="@android:color/transparent" />
</shape>
</clip>
</item>
</layer-list>
同样的platforms/android-8/data/res/drawable/progress_horizontal.xml
文件(机器人-8就是一个例子),并为您的搜索栏XML定义的android:progressDrawable="@drawable/seekbar_bg"
属性。
我假定这样的@android:id/secondaryProgress
项目不需要在Layer List被定义为一个搜索栏,但应验证...
你还可通过宣布由platforms/android-8/data/res/drawable/seek_thumb.xml
激发了当地选择重新定义the thumb symbol selector。
有趣的是,由于我从未使用过SeekBar,所以我学到了很多东西,谢谢! ;)
我对试用/错误的方法和多次更新的道歉...
我的答案有帮助吗?任何精度? – Renaud