1
我想在一個活動上顯示兩個自定義列表視圖。我使用以下XML代碼。如何在android中的一個活動中使用兩個自定義列表視圖?
<LinearLayout android:orientation="horizontal"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<ListView android:id="@+id/list1"
android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="fill_parent" />
<ListView android:id="@+id/list2"
android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="fill_parent" />
</LinearLayout>
源代碼:
ListView list1 = (ListView) findViewById(R.id.list1);
ListView list2 = (ListView) findViewById(R.id.list2);
但列表視圖不填充。 我是Android新手。請幫我 謝謝
你是如何嘗試填充? –
哪個'ListView'沒有被填充,'list1','list2',或者兩者都有?無論哪種情況,您都需要在您嘗試填充列表的地方發佈代碼。 –