0
我環顧四周尋找各種解決方案,但找不到解決問題的任何東西。ListView項目不顯示
我的列表視圖佈局(較大的佈局的一部分):
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:padding="@dimen/activity_horizontal_margin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Advantage"
android:layout_toLeftOf="@+id/tvAdvLevel"/>
<TextView
android:id="@+id/tvAdvLevel"
android:layout_width="@dimen/etOneChar"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textStyle="bold"
android:text="Level"
android:gravity="center_horizontal"/>
</RelativeLayout>
<ListView
android:id="@+id/listAdvantages"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
我的代碼來測試填充它(從一個片段):
String[] strings = {"test 1", "test 2"};
ListView list = (ListView) view.findViewById(R.id.listAdvantages);
list.setAdapter(new ArrayAdapter<String>(
getActivity(), android.R.layout.simple_list_item_1, android.R.id.text1, strings));
結果(空列表視圖):
它確實似乎調整與數量它接收的數組項目。沒有一個只是出現。
您使用的是對自定義的ListView,看atbthis政黨成員也可以幫助ü,中庸之道改變與你TEM的佈局,也apdute數據更對象把在ListView – 2014-10-17 18:49:29
我已經嘗試過,結果相同。這就是爲什麼我正在測試,看看這個簡單的設置是否會起作用,事實並非如此。 – 2014-10-17 18:50:50