错误java.lang.UnsupportedOperationException:无法转换为dimension:type = 0x1

时间:2014-07-26 20:38:18

标签: java android eclipse adt eclipse-adt

这是什么类型的错误消息?我甚至无法理解这一点。我的应用程序工作得很早,直到我尝试在xml中使用一些嵌套的linear layout

xml文件的代码:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/list_item_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:minHeight="@android:attr/listPreferredItemHeight"
        android:orientation="horizontal"
        android:padding="16dp" >

        <ImageView
            android:id="@+id/list_item_icon"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/ic_launcher" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:paddingLeft="16dp" >

            <TextView
                android:id="@+id/list_item_forecast_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Tomorrow" />

            <TextView
                android:id="@+id/list_item_date_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Clear" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/list_item_maxtemp_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="21" />

            <TextView
                android:id="@+id/list_item_mintemp_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="8" />
        </LinearLayout>

    </LinearLayout>

LOGCAT:

    07-27 02:00:13.125: E/AndroidRuntime(24147): FATAL EXCEPTION: main
    07-27 02:00:13.125: E/AndroidRuntime(24147): android.view.InflateException: Binary        XML file line #3: Error inflating class <unknown>
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:371)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.AbsListView.obtainView(AbsListView.java:2226)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.ListView.measureHeightOfChildren(ListView.java:1279)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.ListView.onMeasure(ListView.java:1191)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4919)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4919)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4919)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4919)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.LinearLayout.measureVertical(LinearLayout.java:850)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4919)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2200)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.measure(View.java:15635)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2184)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1268)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1462)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1158)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4914)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.Choreographer.doCallbacks(Choreographer.java:579)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.Choreographer.doFrame(Choreographer.java:548)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.os.Handler.handleCallback(Handler.java:800)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.os.Handler.dispatchMessage(Handler.java:100)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.os.Looper.loop(Looper.java:194)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.app.ActivityThread.main(ActivityThread.java:5371)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at java.lang.reflect.Method.invokeNative(Native Method)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at java.lang.reflect.Method.invoke(Method.java:525)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at dalvik.system.NativeStart.main(Native Method)
    07-27 02:00:13.125: E/AndroidRuntime(24147): Caused by: java.lang.reflect.InvocationTargetException
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at java.lang.reflect.Constructor.constructNative(Native Method)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    ... 48 more
    07-27 02:00:13.125: E/AndroidRuntime(24147): Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.View.<init>(View.java:3571)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.view.ViewGroup.<init>(ViewGroup.java:436)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.LinearLayout.<init>(LinearLayout.java:176)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    at android.widget.LinearLayout.<init>(LinearLayout.java:172)
    07-27 02:00:13.125: E/AndroidRuntime(24147):    ... 51 more

您也可以告诉如何阅读这些类型的错误并进行调试吗?

0 个答案:

没有答案