HtmlCompat

public final class HtmlCompat
extends Object

java.lang.Object
   ↳ androidx.core.text.HtmlCompat


Backwards compatible version of Html.

Summary

Constants

int FROM_HTML_MODE_COMPACT

Flags for fromHtml(String, int, ImageGetter, TagHandler): Separate block-level elements with line breaks (single newline character) in between.

int FROM_HTML_MODE_LEGACY

Flags for fromHtml(String, int, ImageGetter, TagHandler): Separate block-level elements with blank lines (two newline characters) in between.

int FROM_HTML_OPTION_USE_CSS_COLORS

Flag indicating that CSS color values should be used instead of those defined in Color.

int FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE

Flag indicating that texts inside <blockquote> elements will be separated from other texts with one newline character by default.

int FROM_HTML_SEPARATOR_LINE_BREAK_DIV

Flag indicating that texts inside <div> elements will be separated from other texts with one newline character by default.

int FROM_HTML_SEPARATOR_LINE_BREAK_HEADING

Flag indicating that texts inside <h1>~<h6> elements will be separated from other texts with one newline character by default.

int FROM_HTML_SEPARATOR_LINE_BREAK_LIST

Flag indicating that texts inside <ul> elements will be separated from other texts with one newline character by default.

int FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM

Flag indicating that texts inside <li> elements will be separated from other texts with one newline character by default.

int FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH

Flag indicating that texts inside <p> elements will be separated from other texts with one newline character by default.

int TO_HTML_PARAGRAPH_LINES_CONSECUTIVE

Option for fromHtml(String, int): Wrap consecutive lines of text delimited by '\n' inside <p> elements.

int TO_HTML_PARAGRAPH_LINES_INDIVIDUAL

Option for fromHtml(String, int): Wrap each line of text delimited by '\n' inside a <p> or a <li> element.

Public methods

static Spanned fromHtml(String source, int flags)

Invokes Html.fromHtml(String, int) on API 24 and newer, otherwise flags are ignored and Html.fromHtml(String) is used.

static Spanned fromHtml(String source, int flags,