二进制XML文件第1行:二进制XML文件第1行:错误膨胀了类android.support.design.widget.NavigationView [英] Binary XML file line #1: Binary XML file line #1: Error inflating class android.support.design.widget.NavigationView

查看:360
本文介绍了二进制XML文件第1行:二进制XML文件第1行:错误膨胀了类android.support.design.widget.NavigationView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个创建的应用程序菜单,可以正常使用10个月以上.我最近创建了一个发行版,并将其上传到Google,以发布给我的Alpha测试人员.在此之前,我曾尝试创建启动画面( Android启动画面不会t显示失败了,所以我注释了清单中的各行,以便创建发行版并将其发布给仍在Google控制台上等待测试的测试人员,然后回到调试模式,一切都变了搞砸了.我研究并纠正了除此错误以外的所有错误,我简直无法使导航视图正常工作.

I have an application menu I had created that has been working just fine for over 10 months. I recently created a release and uploaded it to Google for release to my alpha testers. Prior to that I attempted to create a splash screen (Android Splash Screen doesn't display which failed miserably, so I commented out the lines in the manifest in order to create the release and get it out to my testers which is still pending on Google console. I then went back to debug mode and everything went to hell in a hand basket. What a mess. I researched and corrected all the errors I was getting except this one, I simply cannot make the navigation view work.

这是包含导航视图的布局:

This is the layout that contains the navigation view:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">
  <ViewStub
    android:id="@+id/layout_stub"
    android:inflatedId="@+id/message_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="0.75" />
  <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" />
</android.support.v4.widget.DrawerLayout>

这是nav_header_main:

This is nav_header_main:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="@dimen/nav_header_height"
    android:background="@drawable/side_nav_bar"
    android:gravity="bottom"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    android:minWidth="25px"
    android:minHeight="25px">
    <TextView
        android:text="Main Menu"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView1"/>
</LinearLayout>

这是side_nav_bar:

This is side_nav_bar:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:angle="135"
        android:centerColor="#FFD700"
        android:endColor="#FFD700"
        android:startColor="#FFD700" 
        android:type="linear" />
  <!--FFD700 gold 42586E original -->
</shape>

我删除了所有与启动屏幕尝试有关的代码.

I had removed all code related to the splash screen attempt.

我不知道为什么这个抽屉菜单不再起作用.我四处寻找答案,却一无所获.当一切正常进行时,为什么这突然不起作用?我想念什么?

I have no idea why this drawer menu is no longer working. I've looked all over for answers and have found nothing. Why is this all of sudden not working when it had been working right along? What am I missing?

推荐答案

好,我知道了.好像是这样的:

Ok, I figured it out. Seems like the line:

android:theme="@style/AppTheme"

从清单中删除了

<application android:allowBackup="true" android:label="Organize My League" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:icon="@mipmap/launchicons">
</application>

我将其添加回:

<application android:allowBackup="true" android:label="Organize My League" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:icon="@mipmap/launchicons" android:theme="@style/AppTheme">
</application>

现在,NavigationView会正确膨胀.像这样的疯狂小事无时无刻不在发生.不知道主题线什么时候消失了,但是确实消失了.

Now the NavigationView inflates properly. Maddening little things like this happen all the time. No idea at what point the theme line disappeared, but it did.

这篇关于二进制XML文件第1行:二进制XML文件第1行:错误膨胀了类android.support.design.widget.NavigationView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆