2
問題與API有關。在API 9+細胞看起來完全是這樣:ListView的自定義單元格與API9中的父級寬度不匹配
但是在Android 2.3它看起來像這樣:
我找不到這個原因。這裏是我的單元佈局:
<LinearLayout
android:id="@+id/cell_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/rounded_cell"
android:orientation="vertical"
android:padding="5dp" >
...content here
</LinearLayout>
這個名單片段佈局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_gray" >
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#00000000"
android:paddingTop="5dp" >
</ListView>
</FrameLayout>
的問題是肯定的佈局,因爲它會顯示錯誤即使在Eclipse中的佈局編輯器中。如何使它適用於所有API的9+?