小编Jin*_*ark的帖子

在 Android 上动态添加 imageViews

我想显示来自 HTML 的图像,并且我使用Jsoup. 但是,一个问题是每个帖子都有不同数量的图片。所以,我无法修复 xml 布局中 ImageView 的数量。经过研究,我知道我可以动态创建ImageViews。所以,我创建ImageViews并将它们插入到 Linearlayout. 但是,我只能看到我最后插入的一张图片。

package kr.ac.mju.hanmaeum.activity.notice;

import android.content.Intent;
import android.media.Image;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import kr.ac.mju.hanmaeum.R;
import kr.ac.mju.hanmaeum.activity.BaseActivity;
import kr.ac.mju.hanmaeum.utils.Constants;


public class NoticeContent extends BaseActivity {
    private String url, title, timestamp, content = "";
    private TextView timestampView, titleView;
    private ImageView contentImageView, contentImageView2;
    private …
Run Code Online (Sandbox Code Playgroud)

layout android imageview jsoup android-glide

4
推荐指数
1
解决办法
8175
查看次数

标签 统计

android ×1

android-glide ×1

imageview ×1

jsoup ×1

layout ×1