/ / Determine whether the img tag is contained in the string if (!TextUtils.isEmpty(content) && content.indexOf("<img") != -1) { //img tag regular String regEx_img = "<img.*src\\s*=\\s*(.*?)[^>]*?>"; Pattern p_image = Pattern.compile(regEx_img, Pattern.CASE_INSENSITIVE); Matcher m_image = p_image.matcher(content); / / Loop to remove the img tag while (m_image.find()) { String group = m_image.group(); Log.e("fhxx", "html--->" + group); content = content.replace(group, ""); Log.e("fhxx", "Interception--->" + content); } } textview.setText(Html.fromHtml(content));
Android removes the img tag in rich text (html code)
Guess you like
Origin blog.csdn.net/jiexiao4151/article/details/120828316
Recommended
Ranking