HtmlCompat
class HtmlCompat
Backwards compatible version of Html.
Summary
Constants |
|
|---|---|
const Int |
Flags for |
const Int |
Flags for |
const Int |
Flag indicating that CSS color values should be used instead of those defined in |
const Int |
Flag indicating that texts inside |
const Int |
Flag indicating that texts inside |
const Int |
Flag indicating that texts inside |
const Int |
Flag indicating that texts inside |
const Int |
Flag indicating that texts inside |
const Int |
Flag indicating that texts inside |
const Int |
Option for |
const Int |
Option for |
Public functions |
|
|---|---|
java-static Spanned |
Invokes |
java-static Spanned |
fromHtml(Invokes |
java-static String |
Invokes |
Constants
FROM_HTML_MODE_COMPACT
const val FROM_HTML_MODE_COMPACT = 63: Int
Flags for fromHtml: Separate block-level elements with line breaks (single newline character) in between. This inverts the Spanned to HTML string conversion done with the option TO_HTML_PARAGRAPH_LINES_INDIVIDUAL.
FROM_HTML_MODE_LEGACY
const val FROM_HTML_MODE_LEGACY = 0: Int
Flags for fromHtml: Separate block-level elements with blank lines (two newline characters) in between. This is the legacy behavior prior to N.
FROM_HTML_OPTION_USE_CSS_COLORS
const val FROM_HTML_OPTION_USE_CSS_COLORS = 256: Int
Flag indicating that CSS color values should be used instead of those defined in Color.
FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE
const val FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE = 32: Int
Flag indicating that texts inside <blockquote> elements will be separated from other texts with one newline character by default.
FROM_HTML_SEPARATOR_LINE_BREAK_DIV
const val FROM_HTML_SEPARATOR_LINE_BREAK_DIV = 16: Int
Flag indicating that texts inside <div>elements will be separated from other texts with one newline character by default.
FROM_HTML_SEPARATOR_LINE_BREAK_HEADING
const val FROM_HTML_SEPARATOR_LINE_BREAK_HEADING = 2: Int
Flag indicating that texts inside <h1>~<h6> elements will be separated from other texts with one newline character by default.
FROM_HTML_SEPARATOR_LINE_BREAK_LIST
const val FROM_HTML_SEPARATOR_LINE_BREAK_LIST = 8: Int
Flag indicating that texts inside <ul> elements will be separated from other texts with one newline character by default.
FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM
const val FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM = 4: Int
Flag indicating that texts inside <li> elements will be separated from other texts with one newline character by default.
FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH
const val FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH = 1: Int
Flag indicating that texts inside <p> elements will be separated from other texts with one newline character by default.
TO_HTML_PARAGRAPH_LINES_CONSECUTIVE
const val TO_HTML_PARAGRAPH_LINES_CONSECUTIVE = 0: Int
Option for fromHtml: Wrap consecutive lines of text delimited by '\n' inside <p> elements. BulletSpans are ignored.
TO_HTML_PARAGRAPH_LINES_INDIVIDUAL
const val TO_HTML_PARAGRAPH_LINES_INDIVIDUAL = 1: Int
Option for fromHtml: Wrap each line of text delimited by '\n' inside a <p> or a <li> element. This allows ParagraphStyles attached to be encoded as CSS styles within the corresponding <p> or <li> element.
Public functions
fromHtml
java-static fun fromHtml(source: String, flags: Int): Spanned
Invokes fromHtml on API 24 and newer, otherwise flags are ignored and fromHtml is used.
fromHtml
java-static fun fromHtml(
source: String,
flags: Int,
imageGetter: Html.ImageGetter?,
tagHandler: Html.TagHandler?
): Spanned
Invokes fromHtml on API 24 or newer, otherwise flags are ignored and fromHtml is used.