java.lang.RuntimeException:无法启动活动ComponentInfo:android.view.InflateException:二进制XML文件行#20:错误膨胀类

时间:2016-03-04 14:22:36

标签: java android eclipse compiler-errors

当我删除按钮的文本并放置图片时,我的应用程序的活动正常运行。之后,活动停止了工作。

我在另一项活动中做了同样的事情并没有提出问题。

我的错误日志是:

03-04 11:04:42.513: E/AndroidRuntime(31224): FATAL EXCEPTION: main
03-04 11:04:42.513: E/AndroidRuntime(31224): Process: com.example.pdv, PID: 31224
03-04 11:04:42.513: E/AndroidRuntime(31224): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pdv/com.example.pdv.RecebimentosParciais}: android.view.InflateException: Binary XML file line #20: Error inflating class <unknown>
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.ActivityThread.access$800(ActivityThread.java:141)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.os.Handler.dispatchMessage(Handler.java:102)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.os.Looper.loop(Looper.java:136)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.ActivityThread.main(ActivityThread.java:5113)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at java.lang.reflect.Method.invokeNative(Native Method)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at java.lang.reflect.Method.invoke(Method.java:515)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at dalvik.system.NativeStart.main(Native Method)
03-04 11:04:42.513: E/AndroidRuntime(31224): Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class <unknown>
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.createView(LayoutInflater.java:623)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.Activity.setContentView(Activity.java:1946)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at com.example.pdv.RecebimentosParciais.onCreate(RecebimentosParciais.java:63)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.Activity.performCreate(Activity.java:5248)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)
03-04 11:04:42.513: E/AndroidRuntime(31224):    ... 11 more
03-04 11:04:42.513: E/AndroidRuntime(31224): Caused by: java.lang.reflect.InvocationTargetException
03-04 11:04:42.513: E/AndroidRuntime(31224):    at java.lang.reflect.Constructor.constructNative(Native Method)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.view.LayoutInflater.createView(LayoutInflater.java:597)
03-04 11:04:42.513: E/AndroidRuntime(31224):    ... 24 more
03-04 11:04:42.513: E/AndroidRuntime(31224): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:464)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.widget.TextView.<init>(TextView.java:972)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.widget.Button.<init>(Button.java:107)
03-04 11:04:42.513: E/AndroidRuntime(31224):    at android.widget.Button.<init>(Button.java:103)
03-04 11:04:42.513: E/AndroidRuntime(31224):    ... 27 more

XML活动是:

<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"
    tools:context="com.example.pdv.RecebimentosParciais" >

    <TextView
        android:id="@+id/TextView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Valor:"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <Button
        android:id="@+id/AddRecbutton"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/VoltarRecbutton"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/txt_valor_recebido"
        android:drawableLeft="@android:drawable/ic_menu_save"
        android:textSize="?android:attr/textAppearanceMediumInverse" />

    <EditText
        android:id="@+id/txt_valor_recebido"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/TextView01"
        android:layout_toLeftOf="@+id/TextView02"
        android:ems="10"
        android:inputType="numberDecimal" >

        <requestFocus />
    </EditText>

    <TextView
        android:id="@+id/TextView02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txt_valor_recebido"
        android:layout_centerHorizontal="true"
        android:text="Nome:"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <Spinner
        android:id="@+id/spinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/AddRecbutton"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/txt_nome"
        android:layout_below="@+id/txt_valor_recebido"
        android:entries="@array/formaspagto" />

    <Button
        android:id="@+id/VoltarRecbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Voltar" />

    <EditText
        android:id="@+id/txt_nome"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/TextView02"
        android:layout_below="@+id/TextView02"
        android:layout_toLeftOf="@+id/VoltarRecbutton"
        android:ems="10" >
    </EditText>

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/AddRecbutton"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/txt_divisao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:text="Divisão:"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/txt_totalconta"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txt_divisao"
        android:layout_alignParentLeft="true"
        android:text="Total Conta: R$ 0,00"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#cc0000"
        android:textStyle="bold" />

    <ListView
        android:id="@+id/list_output"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txt_totalconta"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView1" >

    </ListView>

    <TextView
        android:id="@+id/txt_faltatroco"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txt_divisao"
        android:layout_alignParentRight="true"
        android:text="Falta: R$ 0,00"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textStyle="bold" />

</RelativeLayout>

有人可以帮我解决这个问题吗?

0 个答案:

没有答案