【发布时间】:2016-06-13 22:26:27
【问题描述】:
我正在创建一个使用 Material Design 组件的 android 应用程序。我使用了 Material Design 主题(android:Theme.Material),通过 android:Theme.Material 扩展了我的风格。
<style name="MyMaterialTheme.Base" parent="android:Theme.Material.Light">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:navigationBarColor">@color/navigationBarColor</item>
<item name="android:displayOptions">disableHome</item>
</style>
现在,问题是我也想使用工具栏,但由于我遵循了许多教程,如果我想使用工具栏,我需要将 Theme.AppCompat 作为我的父主题。 p>
我尝试使用 Material Design Theme,但将错误抛出为
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity
所以,我的问题是,我不能将 Material Design 主题与 Toolbar 一起使用(因为我也在使用 Card Views,所以 Material Design 主题更可取)?
注意:-我已经使用 AppCompact 主题集成了工具栏,但我只想使用 Material Design 主题。
【问题讨论】:
标签: android android-actionbar material-design android-toolbar android-appcompat