2011-09-08 31 views
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新手。請幫我 謝謝

+0

你是如何嘗試填充? –

+0

哪個'ListView'沒有被填充,'list1','list2',或者兩者都有?無論哪種情況,您都需要在您嘗試填充列表的地方發佈代碼。 –

回答

0

你好我的朋友第一個規則永遠不會放置兩個列表視圖它會因爲滾動而混亂。 也許你想使用滾動視圖和充氣兩個佈局:D

相關問題