Language

Html.FromHtml Method

Definition

Overloads

Name Description
FromHtml(String)
Obsolete.

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

FromHtml(String, FromHtmlOptions)

Returns displayable styled text from the provided HTML string.

FromHtml(String, Html+IImageGetter, Html+ITagHandler)
Obsolete.

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

FromHtml(String, FromHtmlOptions, Html+IImageGetter, Html+ITagHandler)

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

FromHtml(String)

Caution

deprecated

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

[Android.Runtime.Register("fromHtml", "(Ljava/lang/String;)Landroid/text/Spanned;", "")]
[System.Obsolete("deprecated")]
public static Android.Text.ISpanned? FromHtml(string? source);
[<Android.Runtime.Register("fromHtml", "(Ljava/lang/String;)Landroid/text/Spanned;", "")>]
[<System.Obsolete("deprecated")>]
static member FromHtml : string -> Android.Text.ISpanned

Parameters

source
String

The HTML markup to convert.

Returns

The parsed text with formatting represented by spans.

Attributes

Remarks

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

This member is deprecated. use #fromHtml(String, int) instead.

Java documentation for android.text.Html.fromHtml(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

FromHtml(String, FromHtmlOptions)

Returns displayable styled text from the provided HTML string.

[Android.Runtime.Register("fromHtml", "(Ljava/lang/String;I)Landroid/text/Spanned;", "", ApiSince=24)]
public static Android.Text.ISpanned? FromHtml(string? source, Android.Text.FromHtmlOptions flags);
[<Android.Runtime.Register("fromHtml", "(Ljava/lang/String;I)Landroid/text/Spanned;", "", ApiSince=24)>]
static member FromHtml : string * Android.Text.FromHtmlOptions -> Android.Text.ISpanned

Parameters

source
String

The HTML markup to convert.

flags
FromHtmlOptions

The separator and CSS-color options for the conversion.

Returns

The parsed text with formatting represented by spans.

Attributes

Remarks

Returns displayable styled text from the provided HTML string. Any &lt;img&gt; tags in the HTML will display as a generic replacement image which your program can then go through and replace with real images.

This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.

Java documentation for android.text.Html.fromHtml(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

FromHtml(String, Html+IImageGetter, Html+ITagHandler)

Caution

deprecated

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

[Android.Runtime.Register("fromHtml", "(Ljava/lang/String;Landroid/text/Html$ImageGetter;Landroid/text/Html$TagHandler;)Landroid/text/Spanned;", "")]
[System.Obsolete("deprecated")]
public static Android.Text.ISpanned? FromHtml(string? source, Android.Text.Html.IImageGetter? imageGetter, Android.Text.Html.ITagHandler? tagHandler);
[<Android.Runtime.Register("fromHtml", "(Ljava/lang/String;Landroid/text/Html$ImageGetter;Landroid/text/Html$TagHandler;)Landroid/text/Spanned;", "")>]
[<System.Obsolete("deprecated")>]
static member FromHtml : string * Android.Text.Html.IImageGetter * Android.Text.Html.ITagHandler -> Android.Text.ISpanned

Parameters

source
String

The HTML markup to convert.

imageGetter
Html.IImageGetter

An optional callback that supplies drawables for image tags.

tagHandler
Html.ITagHandler

An optional callback for tags the converter does not recognize.

Returns

The parsed text and spans, including content supplied by the callbacks.

Attributes

Remarks

This method was deprecated in API level 24. Use fromHtml(String,int,ImageGetter,TagHandler) instead.

Returns displayable styled text from the provided HTML string with the legacy flags FROM_HTML_MODE_LEGACY.

Android reference for android.text.Html.fromHtml.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

FromHtml(String, FromHtmlOptions, Html+IImageGetter, Html+ITagHandler)

Returns displayable styled text from the provided HTML string with the legacy flags #FROM_HTML_MODE_LEGACY.

[Android.Runtime.Register("fromHtml", "(Ljava/lang/String;ILandroid/text/Html$ImageGetter;Landroid/text/Html$TagHandler;)Landroid/text/Spanned;", "", ApiSince=24)]
public static Android.Text.ISpanned? FromHtml(string? source, Android.Text.FromHtmlOptions flags, Android.Text.Html.IImageGetter? imageGetter, Android.Text.Html.ITagHandler? tagHandler);
[<Android.Runtime.Register("fromHtml", "(Ljava/lang/String;ILandroid/text/Html$ImageGetter;Landroid/text/Html$TagHandler;)Landroid/text/Spanned;", "", ApiSince=24)>]
static member FromHtml : string * Android.Text.FromHtmlOptions * Android.Text.Html.IImageGetter * Android.Text.Html.ITagHandler -> Android.Text.ISpanned

Parameters

source
String

The HTML markup to convert.

flags
FromHtmlOptions

The separator and CSS-color options for the conversion.

imageGetter
Html.IImageGetter

An optional callback that supplies drawables for image tags.

tagHandler
Html.ITagHandler

An optional callback for tags the converter does not recognize.

Returns

The parsed text and spans, including content supplied by the callbacks.

Attributes

Remarks

Returns displayable styled text from the provided HTML string. Any <img> tags in the HTML will use the specified ImageGetter to request a representation of the image (use null if you don't want this) and the specified TagHandler to handle unknown tags (specify null if you don't want this).

This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.

Android reference for android.text.Html.fromHtml.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to