Swa*_*agZ 2 xml android styles inflate-exception navigation-drawer
错误信息:
android.view.InflateException:二进制XML文件行#16:二进制XML文件行#16:在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)错误膨胀类android.support.design.widget.NavigationView
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" />
Run Code Online (Sandbox Code Playgroud)
的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'
}
Run Code Online (Sandbox Code Playgroud)
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" />
Run Code Online (Sandbox Code Playgroud)
我一直在寻找,找不到我的问题的答案.我发现的大多数答案都是在build.gradle中保持设计和appcompat相同.但似乎我已经正确设置了.请帮我.
错误Occure,因为当创建新项目时Android Studio.所有基础的东西都是设置的.有一个名为drawable-v21的可绘制文件夹,它存储像这样的图标xml文件
ic_menu_send.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
</vector>
Run Code Online (Sandbox Code Playgroud)
因此,当您从中进行测试时,below Api 21已将ic_menu_send.png文件放入您的drawable文件夹以支持以下内容Api 21.希望对你有帮助..