Rich text box in android

Is there any control in android that we can use as a rich text box that can handle formatting characters like bold, italics, etc., and use fonts and color?

If anyone has a link or source related to the above information, please share it with me.

+4
source share
3 answers

SpannableString class or HTML.fromHtml() allows you to manipulate various styles in a real line. See the links below:

http://developer.android.com/reference/android/text/SpannableString.html http://developer.android.com/reference/android/text/Html.html#toHtml(android.text.Spanned)

+6
source

Example implementation of SpannableString and TextView:

  TextView tv = new TextView; String text = "String String String String body"; SpannableString spannableStr = new SpannableString(text); spannableStr.setSpan(new StyleSpan(Typeface.BOLD), 0 , 10, 0); tv.setText(spannableStr); 
+1
source

WebView is the closest I can come up with, but it's super-duper heavy if you don't want the whole screen to be a web view.

0
source

Source: https://habr.com/ru/post/902964/


All Articles