Skip to content

tokenlab/KotlinRichTextAndroid

Repository files navigation

Rich Text Parser Example

This shows the basic use of this lib

  •   It shows a HTML text as a formatted text
  •   It accepts tags b strong i em u sub strike sup
  •   Inlined style works too
  •   It also accepts clickable link: our GitHub
  •   It can even be configured to show images!

Easy to use with any image downloader you like.
Check this example to see how to use with Glide

How to use

Add this line on your build.gradle file:
repositories {
  maven { url "https://jitpack.io" }
}

Import the lib:
implementation 'com.github.tokenlab:KotlinRichTextAndroid:x.x.x'

Create a URLImageParser:
val imageDownloader = URLImageParser {
  updateSpan, image -> ...
}

Create a RichTextParser:
val richTextParser = RichTextParser(imageDownloader)

Use it:
richTextParser.parse(textView, htmlText, isClickable)