【发布时间】:2015-08-11 11:33:34
【问题描述】:
我正在尝试将两个 CheckBox 视图添加到我当前使用 AppCompat 库 (v7:22.2.1) 的当前应用程序的反馈片段中。此应用程序的 API 范围是 16-current (22)。我的清单设置了以下主题定义:
android:theme="@style/AppTheme"
在我的styles.xml 文件中是这样定义的:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.FacebookFlatButton">
<item name="android:background">@drawable/facebook_flat_button</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">@android:color/white</item>
</style>
<style name="AppTheme.TwitterFlatButton">
<item name="android:background">@drawable/twitter_flat_button</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">@android:color/white</item>
</style>
</resources>
问题是我的 CheckBox(我也注意到我的 EditText)视图没有默认为正确的颜色,因此在检查时它们是可见的。这是 Android Studio 和我的模拟器并排预览的屏幕截图:
无论我从其他 SO 文章(例如 this one)中放入这种样式的样式项目的哪种组合,颜色在模拟器或设备上都不会改变,但它们会在预览中更新。我还尝试了对自定义主题的父主题的各种调整,但似乎没有任何关系。
我已经在 Nexus 5 (API 19) 和 Nexus 6 (API 22) 模拟器中尝试过这个,它也在我的 Nexus 6 设备上做同样的事情。
我在这里并没有定义太多的自定义,但我仍然觉得我在这里遗漏了一些小的关键信息。我错过了什么?
【问题讨论】:
标签: android checkbox material-design android-theme