我想显示来自 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)