noties / Markwon

Android markdown library (no WebView)
https://noties.io/Markwon/
Apache License 2.0
2.74k stars 309 forks source link

image display bad inside blockquote #364

Open keluokeda opened 3 years ago

keluokeda commented 3 years ago

rt

image
  val textView = findViewById<TextView>(R.id.text)
        val image = findViewById<ImageView>(R.id.image)

        val imageUrl =
            "https://img.nga.178.com/attachments/mon_202108/06/51Q174-1ccqK10T1kSa9-5m.jpg"
        Glide.with(this).load(imageUrl)
            .into(image)

        markwon.setMarkdown(
            textView,
            "<blockquote>11111111<br/><img src=\"$imageUrl\" width=\"100%\"></blockquote>"
        )
noties commented 3 years ago

Hello @keluokeda ,

yeah, unfortunately it is like this. Images are resized to take at maximum available width of a TextView. But if they are inside margin spans (quote is a margin span) this calculation can go wrong. As there is no accessible way to query amount of width reduced by margin spans.

I'm labeling this as a bug and keep it open in case someone would come up with a solution to obtain the width reduced by all parent margin spans