0
我收到錯誤時,我在我的手機上運行應用程序,但是當我通過模擬器啓動它時,它工作正常。仿真器與我的手機運行在相同的2.1 froyo上。我得到手機上的錯誤,但在仿真器上它工作正常
我得到的錯誤是
android.view.InflateException: Binary XML file line #5: Error inflating class <unknown>
的問題發生在這個代碼:
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list, null);
當我試圖誇大這一觀點。順便說一句在我的xml代碼是evrything ok,否則它不會在模擬器上工作。
但如果ü在這裏想我的幫助是:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="15dp"
android:background="@drawable/bg_seznam" >
<TextView
android:id="@+id/item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="17dp"
android:textColor="#ffffff"
android:textSize="20dp"
android:textStyle="bold"
android:typeface="serif" >
</TextView>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<TextView
android:id="@+id/item_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:ellipsize="end"
android:maxLines="1"
android:paddingLeft="17dp"
android:scrollHorizontally="true"
android:singleLine="false"
android:textSize="18dp"
android:textStyle="bold"
android:typeface="serif" >
</TextView>
<TextView
android:id="@+id/item_distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:ellipsize="end"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="false"
android:textColor="#3b5688"
android:textSize="18dp"
android:textStyle="bold"
android:typeface="serif" >
</TextView>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:contentDescription="@string/hello_world"
android:src="@drawable/naprej" />
</TableRow>
</TableLayout>
編輯:順便說一句,這是相同的,如果我用這個:
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list, null);
發佈整個堆棧跟蹤請 – AMerle 2012-08-08 08:10:42
對不起,我不totalonty如何做到這一點:S – gabrjan 2012-08-08 08:15:44
你只是'錯誤膨脹類',請張貼其他行的logcat。 –
AMerle
2012-08-08 08:17:48