【问题标题】:Dynamically display ImageView with Multi-line Linear Layout使用多行线性布局动态显示 ImageView
【发布时间】:2012-12-19 18:30:12
【问题描述】:

我将动态地将 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 仅显示 1 行图像。剩下的图像不见了。我应该在代码中放入什么,以便 LinearLayout 自动跳转到新行并加载所有图像?例如:4 行每行 3 张图像?

[图片] [图片] [图片] [图片]
[图片] [图片] [图片] [图片]
[图片] [图片] [图片] [图片]

【问题讨论】:

    标签: android imageview android-linearlayout


    【解决方案1】:

    【讨论】:

    • 我听说过 ListView.. 但是我想实现我上面的问题中更新的照片库类型的应用程序。
    • 那么您只需要创建具有固定高度和宽度的ImageView,并通过其方法addView()添加到LinearLayout
    猜你喜欢
    • 1970-01-01
    • 2020-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多