【发布时间】:2016-11-12 07:17:19
【问题描述】:
错误信息:
android.view.InflateException:二进制 XML 文件第 16 行:二进制 XML 文件第 16 行:膨胀类错误 android.support.design.widget.NavigationView 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
xml 文件:
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "edu.zhanglrose_hulman.bigbelly"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services:9.2.0'
}
styles.xml
<!-- 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>
<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" />
我一直在到处寻找,找不到我的问题的答案。我发现的大部分答案是在 build.gradle 中保持设计和 appcompat 相同。但似乎我已经正确设置了。请帮我。
【问题讨论】:
-
请编辑您的问题以提供完整的堆栈跟踪,并修复您的格式。
-
在问题中发布您的
styles.xml文件.. -
@MikeM。对不起格式。我是 StackOverFlow 的新手。
-
@Ironman,我发布了我的 styles.xml。
-
@user3914955 您正在测试哪个设备,您能告诉我
API version之类的4.0还是其他什么的......
标签: android xml styles navigation-drawer inflate-exception