【发布时间】:2020-07-20 11:08:39
【问题描述】:
我的应用中有这个SeekBar:
<SeekBar
android:id="@+id/volume_seek_bar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:theme="@style/Volume_Seekbar" />
这是样式文件:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/toolbar_background</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="ProgressBarStyle">
<item name="colorAccent">@color/colorPrimary</item>
</style>
<style name="Volume_Seekbar">
<item name="colorPrimary">@color/app_blue</item>
<item name="colorPrimaryDark">@color/toolbar_background</item>
<item name="colorAccent">@color/app_blue</item>
</style>
我想使用该样式来更改SeekBar 的颜色,但它一直采用AppTheme 样式的颜色定义。知道是什么问题吗?
【问题讨论】:
-
您在哪个设备上测试过 API 级别?
-
@Raj 使用 Android 9(Samsung 8),API 级别 - 28
标签: android android-layout material-components-android android-seekbar android-slider