2012-12-19 44 views
1

我打算把ImageView的的的LinearLayout內動態地(在代碼中)我只在我的XML定義這個LinearLayout中:動態顯示的ImageView與多線線性佈局

<LinearLayout 
    android:id="@+id/pictures" 
    android:orientation="horizontal" 
    android:singleLine="false" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 
</LinearLayout> 

目前,LinearLayout中只顯示1圖像線。剩下的圖像消失了。我應該在代碼中放置什麼,以使LinearLayout自動跳轉到新行並加載所有圖像?例如:4行每行3個圖像?

[圖像] [圖像] [圖像] [圖像]
[圖像] [圖像] [圖像] [圖像]
[圖像] [圖像] [圖像] [圖像]

回答

0
+0

我聽說過ListView的。但是我想實現圖片庫在我上面的問題中更新了一種應用程序。 –

+0

然後您只需創建具有固定高度和寬度的'ImageView',並通過其方法addView()' –

+0

添加到'LinearLayout'中,最後我使用gridview。感謝你的回答 :) –