Set max width 100% for images

master
M66B 5 months ago
parent ad656072af
commit 33d1b98216

@ -52,7 +52,7 @@ public class HtmlEx {
private static final int TO_HTML_PARAGRAPH_FLAG = 0x00000001;
public HtmlEx(Context context){
public HtmlEx(Context context) {
this.context = context;
}
@ -109,7 +109,7 @@ public class HtmlEx {
String elements = " ";
boolean needDiv = false;
for(int j = 0; j < style.length; j++) {
for (int j = 0; j < style.length; j++) {
if (style[j] instanceof AlignmentSpan) {
Layout.Alignment align =
((AlignmentSpan) style[j]).getAlignment();
@ -465,6 +465,8 @@ public class HtmlEx {
out.append(((ImageSpan) style[j]).getSource());
out.append("\"");
out.append("style=\"max-width: 100%; height: auto;\"");
if (style[j] instanceof ImageSpanEx) {
ImageSpanEx img = (ImageSpanEx) style[j];
int w = img.getWidth();

Loading…
Cancel
Save