Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用多行线性布局动态显示ImageView_Android_Imageview_Android Linearlayout - Fatal编程技术网

Android 使用多行线性布局动态显示ImageView

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

我将动态地(在代码中)将ImageView放入LinearLayout中。我只在XML中定义了此LinearLayout:

<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