I convert HTML string to spannable by using HtmlCompat.fromHtml(...)
, the ImageGetter
I use simply uses Glide to download images. By using ContextCompat.getDrawable(...)
for comparison it gives similar result indeed.
In emulator with API level 16, it displays correctly like this:
However in emulator with API level 28 it gives extra space above the image like this:
Would anyone help me solving this inconsistency problem? Thank you.
Code snippet
val spanned = HtmlCompat.fromHtml(html, HtmlCompat.FROM_HTML_MODE_LEGACY, Html.ImageGetter {
ContextCompat.getDrawable(context, drawableResId)?.apply {
setBounds(0, 0, intrinsicWidth, intrinsicHeight)
}
}, tagHandler)