我的鬧鐘設計佈局listView
看起來像下面的圖片。無法轉換爲尺寸:類型= 0x12
custom_row_view
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="Time"
android:paddingLeft="40dp"
android:paddingTop="15dp"
android:textColor="@color/black"
android:textStyle="bold"
/>
<ToggleButton
android:id="@+id/switchAlarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textOff=""
android:textOn=""
android:layout_marginLeft="200dp"
android:drawableTop="@mipmap/switch_alarm"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:id="@+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:layout_marginRight="@+id/textView"
android:id="@+id/textView1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:layout_marginRight="@+id/textView1"
android:id="@+id/textView2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:layout_marginRight="@+id/textView2"
android:id="@+id/textView3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:layout_marginRight="@+id/textView3"
android:id="@+id/textView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:layout_marginRight="@+id/textView4"
android:id="@+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Text"
android:layout_marginRight="@+id/textView5"
android:id="@+id/textView6" />
</LinearLayout>
</LinearLayout>
我的應用程序崩潰時,該佈局被調用。
4-14 23:49:10.491 31175-31175/com.example.seng.clock E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:471)
at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:5906)
at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1854)
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1766)
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:58)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:748)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at Adapter.MyCustomBaseAdapter.getView(MyCustomBaseAdapter.java:68)
at android.widget.AbsListView.obtainView(AbsListView.java:2232)
你到Android分配ID:layout_marginRight而不是尺寸。 –