Android 使用多行线性布局动态显示ImageView
我将动态地(在代码中)将ImageView放入LinearLayout中。我只在XML中定义了此LinearLayout:Android 使用多行线性布局动态显示ImageView,android,imageview,android-linearlayout,Android,Imageview,Android Linearlayout,我将动态地(在代码中)将ImageView放入LinearLayout中。我只在XML中定义了此LinearLayout: <LinearLayout android:id="@+id/pictures" android:orientation="horizontal" android:singleLine="false" android:layout_width="fill_parent" android:layout_height="wrap_conten
<LinearLayout
android:id="@+id/pictures"
android:orientation="horizontal"
android:singleLine="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</LinearLayout>
目前,LinearLayout仅显示一行图像。剩下的图像不见了。我应该在代码中添加什么,以便LinearLayout自动跳转到新行并加载所有图像?例如:每行3张图片,共4行
[图像][图像][图像][图像][图像][图像][图像][图像]
[image][image][image][image]
您可能应该使用
ListView
而不是LinearLayout
。
因为列表视图
提供了添加与项目相同类型的视图
的功能
做一些事情
1)
2)
3)
4) 我听说了ListView。。但是,我想实现一个照片库类应用程序,正如我在上面的问题中所更新的。然后,您只需要创建具有固定高度和宽度的ImageView
,并通过其方法添加到LinearLayout