本文介绍了android.view.InflateException:二进制XML文件第1行:错误夸大类< unknown>背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有背景图像的活动-现在我想对其进行更改,然后将新图像复制到drawable-hdmi文件夹中-将其重命名为Background,并删除了该文件夹中的旧图像

I have a activity with a Background Image - now I would like to Change it and copied the new one in the drawable-hdmi Folder - rename it to Background an have deleted the old one in the Folder

但是现在我可以将无图片"作为背景-每次出现上述错误

but now I can put None Picture as Background - every time appears above mentioned error

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
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:background="@drawable/background"
>

我该怎么办-已将其清理干净

What can I do - have cleaned it already

02-11 21:58:33.653  10226-10226/de.tetzisoft.virjouthrger E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{de.tetzisoft.virjouthrger/de.tetzisoft.virjouthrger.ICit_A}: android.view.InflateException: Binary XML file line #1: Error inflating class
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2071)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
            at android.app.ActivityThread.access$600(ActivityThread.java:138)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:4787)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class
            at android.view.LayoutInflater.createView(LayoutInflater.java:613)
            at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
            at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
            at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
            at de.tetzisoft.virjouthrger.ICit_A.onCreate(ICit_A.java:16)

比如说Android Studio

So say Android Studio

推荐答案

1)确保将资源命名为背景"而不是背景".这是区分大小写的.

1) Make sure you name your resource "background" and not "Background". It's case-sensitive.

2)如果使用Windows资源管理器而不是Android Studio更改了资源,请刷新项目以更新资源.

2) If you changed the resource using Windows Explorer and not Android Studio, refresh the project to update the resources.

3)您将可绘制文件夹拼写为"drawable-hdmi".它应该是"drawable-hdpi".

3) You spelled your drawable folder like this "drawable-hdmi". It should be "drawable-hdpi".

4)将资源放在可绘制"(默认文件夹)中,以防设备的密度为mdpi或更低.

4) Put the resource in "drawable" (default folder) just in case your device's density is mdpi or lower.

这篇关于android.view.InflateException:二进制XML文件第1行:错误夸大类&lt; unknown&gt;背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:03