Seek bar, change path color from yellow to white(搜索栏,将路径颜色从黄色更改为白色)
问题描述
我有两个问题:
1) 如何将搜索栏(路径)的颜色从黄色(默认颜色)更改为白色.我的意思是,当我滑动拇指时,它会将穿过的线从灰色变为黄色.我希望轨道/线保持灰色或白色.基本上我只希望拇指移动而在搜索栏中没有颜色变化.
1) how do I change the color of the seek bar (path) from yellow (the default color) to white. What I mean to say is, while I slide the thumb , it turns the line traversed from grey to yellow. I want track/line to either remain grey or white..Basically I want just the thumb to move with no color change in the seek bar.
2)如何将搜索栏的拇指从矩形更改为圆形/球形/圆形.
2) How to change the thumb of seekbar from rectangle to circle/sphere/round shape.
任何指针将不胜感激.
推荐答案
我想为刚接触系统的人完成上面的答案,
I want to complete the answer from above for the people who are new to the system,
缺少的 xmls( background_fill , progress_fill 和 progress 可能看起来像渐变红色
the missing xmls ( background_fill , progress_fill and progress could look like that for a gradient red
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@drawable/background_fill" />
<item android:id="@android:id/progress">
<clip android:drawable="@drawable/progress_fill" />
</item>
</layer-list>
background_fill.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#FF555555"
android:centerColor="#FF555555"
android:endColor="#FF555555"
android:angle="90" />
<corners android:radius="5px" />
<stroke
android:width="2dp"
android:color="#50999999" />
<stroke
android:width="1dp"
android:color="#70555555" />
</shape>
progress_fill.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#FF470000"
android:centerColor="#FFB80000"
android:endColor="#FFFF4400"
android:angle="180" />
<corners android:radius="5px" />
<stroke
android:width="2dp"
android:color="#50999999" />
<stroke
android:width="1dp"
android:color="#70555555" />
</shape>
我没有完成android:thumb的实现,所以拇指还是原来的那个
i did not complete the implementing for android:thumb, so the thumb will be still the original one
因此,我们只需从定义搜索栏的布局 xml 中再次删除这一行
Therefore we just have to delete this line again from our layout xml where we define the seekbar
android:thumb="@drawable/thumb"
祝你好运!!!
这篇关于搜索栏,将路径颜色从黄色更改为白色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:搜索栏,将路径颜色从黄色更改为白色
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
