I am using Html.ImageGetter
to insert images into spanned HTML.
When I run the app on Android Emulator (Lollipop, it renders fine. Running the app on my phone KitKat causes (may a times) images to overlap (and hide text).
Going through docs, I didn't find any such reference in the changelog. So what could be the reason?
I have tried Android ImageGetter images overlapping text, but this doesn't seem to work.
Call:
contentTV.setText(Html.fromHtml(content, new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
inlineImagesCount++;
HttpGetDrawableTaskAsync httpGetDrawableTaskAsync = new HttpGetDrawableTaskAsync(
contentTV, content);
httpGetDrawableTaskAsync.execute(source);
return null;
}
}, null));
Rendering code:
protected void onPostExecute(final Pair<String, ByteArrayOutputStream> result) {
if (result.getSecond() != null) {
if (inlineImagesMap.get(result.getFirst()) == null)
inlineImagesMap.put(result.getFirst(), result.getSecond());
taskTextView.setText(Html.fromHtml(taskHtmlString,
new Html.ImageGetter() {
@Override
public Drawable getDrawable(String source) {
Drawable inlineImage = expandBAOStoDrawable(inlineImagesMap.get(source));
return inlineImage;
}
}, null));
}
if (--inlineImagesCount == 0) {
freeInlineImagesMap();
}
}
Example: Left-Kitkat, Right- Lollipop (The two images for each are scrolled to show full content)
The HTML it rendered is here.