在使用DrawerLayout的时候出现了这个错误,可以参考以下步骤进行检查
1.确认引入对应support库
compile 'com.android.support:design:22.2.0'//版本自己确定
compile 'com.android.support:appcompat-v7:22.2.0'//版本自己确定
2.确认style中添加了对应theme
<!-- Base application theme. -->
<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>
<!-- DrawerLayout theme. -->
<style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
3.确保你的 activity extends AppCompatActivity 并且使用 Theme.AppCompat 主题. 由于 FloatingActionButton 需要引用 colorAccent 所以请确保在你的 theme 中已经定义colorAccent
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。