【发布时间】:2015-03-12 10:19:12
【问题描述】:
我正在为我的应用程序使用 appcompat v21.0.3。我所做的一切都像这里写的那样:android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html
但在 Lollipop 上(当然还有旧设备上),一些小部件没有用我的强调色着色。例如:
SwitchCompat 有色:
ListPreference 未着色
ProgressDialog 未着色
这是我的代码:
build.gradle
...
compile 'com.android.support:appcompat-v7:21.0.+'
...
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CET"
android:hardwareAccelerated="true"
tools:replace="label">
themes.xml
<resources>
<style name="CET" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
</resources>
colors.xml
<resources>
<!-- App branding color -->
<color name="primary">#a32b30</color>
<!-- Darker variant for status bar and contextual app bars -->
<color name="primary_dark">#000000</color>
<!-- Theme UI constrols like checkboxes and text fields -->
<color name="accent">#a32b30</color>
</resources>
有人有想法吗?
更新:截至 2015 年 6 月,仍然无法正常工作,但我最终使用了 https://github.com/afollestad/material-dialogs。非常适合对话框,包括 ListPreferences。
【问题讨论】:
标签: android android-widget android-5.0-lollipop android-appcompat