本文介绍了android.view.inflateexception二进制xml文件行#1错误充气类android.widget.relativeLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我是新的在android。我刚刚做了一个新的布局与一个文本栏和2个按钮,但它没有工作,我发布堆栈跟踪和我的相对布局文件任何想法这个?我看到同样的问题,那就是减少画画尺寸。但是在我的情况下没有帮助,或者我现在不了解如何减少它。
这是我的一些堆栈跟踪:
D / AndroidRuntime(1192):关闭VM
W / dalvikvm(1192):threadid = 1:线程退出与未捕获的异常(组= 0xb60cc4f0)
E / AndroidRuntime(1192):FATAL EXCEPTION:main
E / AndroidRuntime(1192):java.lang .RuntimeException:无法启动活动ComponentInfo {com.example.hellomissworld / com.example.hellomissworld.MainActivity}:android.view.InflateException:二进制XML文件行#1:错误膨胀类android.widget.RelativeLayout
E / AndroidRuntime(1192):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-24 18:58:31.451:E / AndroidRuntime(1192):在android.app.ActivityThread.handleLaunchActivity ActivityThread.java:1663)
12-24 18:58:31.451:E / AndroidRuntime(1192):android.app.ActivityThread.access $ 1500(ActivityThread.java:117)
12-24 18 :58:31.451:E / AndroidRuntime(1192):android.app.ActivityThread $ H.handleMessage(ActivityThread.java:9 31)
这是xml文件的布局:
< RelativeLayout xmlns:android =http://schemas.android.com/apk/res/android
xmlns:tools = http://schemas.android.com/tools
android:layout_width =wrap_content
android:layout_height =match_parent
android:background =@ layout / activity_main
android:focusable =false
android:paddingBottom =@ dimen / activity_vertical_margin
android:paddingLeft =@ dimen / activity_horizontal_margin
android:paddingRight =@ dimen / $ _
工具:上下文=。主要活动>
< EditText
android:id =@ + id / editText1
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_alignParentLeft =true
android:layout_alignParentRight =true
android:layout_marginTop =24dp
android:ems =10
android:inputType = text>
< requestFocus />
< / EditText>
< TextView
android:id =@ + id / textView1
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_alignLeft =@ + id / editText1
android:layout_alignParentTop =true
android:text =@ string / typehere
android:textAppearance =?android: attr / textAppearanceMedium/>
< Button
android:id =@ + id / button2
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_alignRight =@ + id / editText1
android:layout_below =@ + id / editText1
android:text =@ string / ok/>
< Button
android:id =@ + id / button1
android:layout_width =wrap_content
android:layout_height =wrap_content
android:layout_below =@ + id / editText1
android:layout_toLeftOf =@ + id / button2
android:text =@ string / cancel/>
解决方案
您必须更改
android:background =@ layout / activity_main
to
android:background = @ drawable / yourImageName
Hello guys i am new in android.
I just made a new layout with one text bar and 2 buttons but it didn't work, I am posting the stack trace and my relative layout file any idea about this? I saw the same question there which says to decrease the draw able size. But it didn't help in my case or i didn't now much about how to decrease it.Here is some of my stack trace:
D/AndroidRuntime(1192): Shutting down VM
W/dalvikvm(1192): threadid=1: thread exiting with uncaught exception (group=0xb60cc4f0)
E/AndroidRuntime(1192): FATAL EXCEPTION: main
E/AndroidRuntime(1192): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hellomissworld/com.example.hellomissworld.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
E/AndroidRuntime(1192):at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-24 18:58:31.451: E/AndroidRuntime(1192): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-24 18:58:31.451: E/AndroidRuntime(1192): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-24 18:58:31.451: E/AndroidRuntime(1192): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
and that is the xml file of lay out :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@layout/activity_main"
android:focusable="false"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="24dp"
android:ems="10"
android:inputType="text" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/editText1"
android:layout_alignParentTop="true"
android:text="@string/typehere"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/editText1"
android:layout_below="@+id/editText1"
android:text="@string/ok" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/editText1"
android:layout_toLeftOf="@+id/button2"
android:text="@string/cancel" />
解决方案
You have to change
android:background="@layout/activity_main"
to
android:background="@drawable/yourImageName"
这篇关于android.view.inflateexception二进制xml文件行#1错误充气类android.widget.relativeLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!