问题描述
我想更改搜索栏的进度颜色和拇指颜色.我使用了drawable来更改进度颜色,但是更改了进度厚度.有什么方法可以改变拇指并改变颜色.
I would like to change progress color and thumb color of seek bar. I used drawable to change progress color but the progress thickness is changed. Is there any way to change thumb and progress color.
我想更改默认搜索栏的颜色,例如图像上的第二个.
I want to change color of default seekbar like second one on the Image.
推荐答案
如果您在项目中使用Material Theme,这将非常简单
This is very simple if you are using Material Theme in your project
只需先检查您的清单中使用的是哪种样式就像下面这样:
Just check first which style are you using in your manifest for your appIt would be something like below:
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
现在关注@style/AppTheme
您可能需要设置父主题:Theme.AppCompat.Light.DarkActionBar
You will probably want to set your parent theme :Theme.AppCompat.Light.DarkActionBar
注意:colorAccent
属性将为您的所有小部件提供所需的颜色
Note: The colorAccent
attribute will give the desired color to all your widgets
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/PrimaryColor</item>
<item name="colorPrimaryDark">@color/DarkPrimaryColor</item>
<item name="colorAccent">@color/DarkPrimaryColor</item>
<item name="android:textColorSecondary">@color/PrimaryColor</item>
<item name="android:itemBackground">@color/DarkPrimaryColor</item>
<item name="android:textColor">@color/TextIconsColor</item>
</style>
因此,您可以根据需要为布局或活动创建此自定义主题,而不是为整个应用程序主题创建该自定义主题.
So if you want, you can create this custom theme for your layouts or activities instead for your whole app theme.
这适用于我及其根据开发人员指南进行的操作.就这么简单参考: Google Developers
This works for me and its as per Developer Guidelines..As simple as thatRef: Google Developers
这篇关于怎样改变seekbar的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!