我已经更新了我的项目,使用了最新的appcompat支持库,新版本使用了Material Design复选框和单选按钮。我的应用程序是深色主题,复选框是黑色的,很难看到。我正在尝试根据Maintaining Compatibility更改它们的颜色,但目前还没有任何作用。
res/values/styles.xml
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
<!-- customize the color palette -->
<item name="colorAccent">@color/silver</item>
</style>
在 build.gradle 文件中:
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
}
.....
.....
compile 'com.android.support:appcompat-v7:21.0.0'
AndroidManifest.xml:
<application
android:name="ee.mtakso.App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme">
复选框、编辑文本框、单选按钮等仍然是黑色的。
编辑
我不知道这是否有太大的区别,但我使用的单选按钮和复选框是用于CheckedTextView
的,如下:
单选按钮:android:checkMark="?android:attr/listChoiceIndicatorSingle"
多选框:android:checkMark="?android:attr/listChoiceIndicatorMultiple"
由于它们得到了黑色材质的可绘制对象,我认为问题并不是来自它们。