0

这是我的 xml 布局(一个接一个,我注释掉了每个视图,最后保留了一个最小的文本视图。然而,错误出现了)。我了解由于 3 个异常而导致的错误

  1. 调用目标异常
  2. 膨胀异常
  3. 不支持的操作异常。

但不知道如何前进。

编辑 :

所以我发现其他异常的根本原因是UnsupportedOperationException。对此的详细信息是:“无法转换为维度:类型 = 0x1”

不知道现在该怎么办。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/feed_bg"
    >

 <!--    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/feed_item_margin"
        android:layout_marginRight="@dimen/feed_item_margin"
        android:layout_marginTop="@dimen/feed_item_margin"
        android:background="@drawable/bg_parent_rounded_corner"
        android:orientation="vertical"
        android:paddingBottom="@dimen/feed_item_padding_top_bottom"
        android:paddingTop="@dimen/feed_item_padding_top_bottom" 
        android:paddingLeft="@dimen/feed_item_padding_left_right"
        android:paddingRight="@dimen/feed_item_padding_left_right" 
        > !-->

        <TextView
            android:id="@+id/challengeName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:text="Sample Data"
            android:layout_marginLeft="@dimen/feed_item_margin"
            android:gravity="center_horizontal"
            android:textSize="@android:attr/textAppearanceLarge"
             />

      <!--  <TextView
            android:id="@+id/challengeDescription"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="5dp"
            android:paddingTop="@dimen/feed_item_status_pad_top"
            android:text = "sdjflsdkjf lsdkfjlskd lskdfjls lskdjfs lskdfjsl sdklfj "
             /> 


       <com.mykontiki.android.helper.FeedImageView
            android:id="@+id/feedImage1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white"
            android:scaleType="fitXY"
            android:visibility="visible"
             />  

     </LinearLayout> 


     <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/feed_item_margin"
        android:layout_marginRight="@dimen/feed_item_margin"
        android:layout_marginTop="@dimen/feed_item_margin"
        android:layout_marginBottom="@dimen/feed_item_margin"
        android:background="@drawable/bg_parent_rounded_corner"
        android:orientation="vertical"
        android:paddingBottom="@dimen/feed_item_padding_top_bottom"
        android:paddingTop="@dimen/feed_item_padding_top_bottom" 
        android:paddingLeft="@dimen/feed_item_padding_left_right"
        android:paddingRight="@dimen/feed_item_padding_left_right" 
        android:layout_alignParentBottom="true"

        >

         <TextView
            android:id="@+id/challengeStatusName"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="?android:attr/textAppearanceLarge"
            android:textStyle="bold"
            android:text="Do you wish to accept challenge ? "
            android:layout_marginLeft="@dimen/feed_item_margin"
            android:gravity="center_horizontal"
             /> 
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center_horizontal"
            android:layout_alignParentBottom="true"
            android:background="@color/feed_item_bg"

            >

            <ImageButton
                android:id="@+id/buttonDecline"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:src="@drawable/ic_content_decline"

                 />

            <ImageButton
                android:id="@+id/buttonAccept"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:src="@drawable/ic_action_done"
                 />
           </LinearLayout>   

    </LinearLayout>   -->

</RelativeLayout>

这是我得到的 logcat 错误。

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mykontiki.android/com.mykontiki.android.ChallengeDescription}: android.view.InflateException: Binary XML file line #23: Error inflating class <unknown>
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.ActivityThread.access$800(ActivityThread.java:144)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.os.Handler.dispatchMessage(Handler.java:102)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.os.Looper.loop(Looper.java:135)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.ActivityThread.main(ActivityThread.java:5221)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at java.lang.reflect.Method.invoke(Native Method)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at java.lang.reflect.Method.invoke(Method.java:372)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
02-02 22:18:05.598: E/AndroidRuntime(2051): Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class <unknown>
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.createView(LayoutInflater.java:633)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.Activity.setContentView(Activity.java:2144)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at com.mykontiki.android.ChallengeDescription.onCreate(ChallengeDescription.java:24)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.Activity.performCreate(Activity.java:5933)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
02-02 22:18:05.598: E/AndroidRuntime(2051):     ... 10 more
02-02 22:18:05.598: E/AndroidRuntime(2051): Caused by: java.lang.reflect.InvocationTargetException
02-02 22:18:05.598: E/AndroidRuntime(2051):     at java.lang.reflect.Constructor.newInstance(Native Method)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.view.LayoutInflater.createView(LayoutInflater.java:607)
02-02 22:18:05.598: E/AndroidRuntime(2051):     ... 23 more
02-02 22:18:05.598: E/AndroidRuntime(2051): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:572)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.widget.TextView.<init>(TextView.java:999)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.widget.TextView.<init>(TextView.java:629)
02-02 22:18:05.598: E/AndroidRuntime(2051):     at android.widget.TextView.<init>(TextView.java:625)
02-02 22:18:05.598: E/AndroidRuntime(2051):     ... 26 more
4

1 回答 1

1

这是罪魁祸首

android:textSize="@android:attr/textAppearanceLarge"

改变了它的数值。我猜这与我用来测试的应用程序主题和目标设备有关。

于 2015-02-02T17:25:25.543 回答