>当我使用以下样式时
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
我收到错误:
java.lang.RuntimeException: 无法启动活动 ComponentInfo{com.xx.xx/com.xx.xx.setup.SetupASelectLanguageActivity}: java.lang.IllegalStateException
当我将其更改为:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
它没有给出任何错误。
为什么?
主题android:Theme.Material.Light.DarkActionBar.是否依赖于操作系统
虽然应用程序兼容版本已明确添加到您的apk中。 此外,如果您使用的是AppcompatActivity,则最好使用。兼容主题它将避免冲突。