加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Binary XML file line #8: Error inflating class android.suppo

发布时间:2020-12-16 01:57:15 所属栏目:百科 来源:网络整理
导读:在使用DrawerLayout的时候出现了这个错误,可以参考以下步骤进行检查 1.确认引入对应support库 compile 'com.android.support:design:22.2.0' //版本自己确定 compile 'com.android.support:appcompat-v7:22.2.0' //版本自己确定 2.确认style中添加了对应the

在使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读