Android 风格的 SeekBar

标签 android android-styles android-seekbar

我想为我的应用程序的 Seekbar 创建样式。我只想更改拇指和栏本身的颜色。

我设法像这样更改缩略图名称:

<style name="MySeekBar" parent="@style/Widget.AppCompat.SeekBar">
    <item name="android:thumbTint"> @color/turquoise </item>        
 </style>

但我不确定如何更改栏的颜色。我知道如何用代码来做,但不知道在 xml 中:

seekBar.getProgressDrawable().setColorFilter(getContext().getResources().getColor(R.color.turquoise), Mode.SRC_ATOP);

如何使用 xml 中定义的样式设置滤色器的样式?

最佳答案

你可以使用

android:progressTint

改变搜索栏进度部分的颜色

android:progressBackgroundTint

以您的风格更改栏背景的颜色

关于Android 风格的 SeekBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44522038/

相关文章:

android - 更改 Android 中的媒体音量?

Android:这个 google analytics dispatcher 警告是什么意思?

android - 带有深色文本的白色标签

android - 使用 AlertDialog.Builder.setCustomTitle() 时设置默认文本样式

android - Kotlin init block 没有执行

java - 调整 Fragment 中 TextView 的文本大小

android - 如何将原始json数据传递给retrofit 2.0

android - 如何使用样式全局更改 AlertDialog 上的按钮文本颜色?

android - 为 Android SeekBar progressDrawable 使用渐变

java - 使用RelativeLayout时出现意外的黑色 View