我正在开发一个应用程序,该应用程序将从SD-Card获取图像,并将它们分别显示在布局中,如下所示

The Issue is:假设用户在SD-Card中有100+文件,为了在布局中显示它们,我需要添加第一个100+视图,然后我会做样式。Wrong approach
My Question is:My research includes:我尝试使用网格视图布局,但它不能完全满足我的需求,因为它对所有网格都有统一的大小。此外,我知道如何以编程方式添加布局,但我不知道如何让它与我的设计一起工作。
发布于 2014-01-29 19:56:52
您可以通过将您的xml两侧可滚动更改为-
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320px" android:layout_height="fill_parent">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linlay" android:layout_width="320px"
android:layout_height="fill_parent" android:stretchColumns="1"
android:background="#000000"/>
</HorizontalScrollView>
发布于 2014-01-29 20:31:18
使用这种方法:
1.)将所有图像的路径放入数组列表中。
2.)创建一个for循环,它将运行到arraylist的大小。
3.)在这个循环中,使用代码创建您的图像视图。
ImageView im = new ImageView(this);4.)要显示图像,请在src属性中添加arraylist中的路径。
你需要使用一些额外的布局参数来根据你的需要进行设计。
https://stackoverflow.com/questions/21429114
复制相似问题