An explanation of the HTML class of Android development

Source: Internet
Author: User

HTML classes are often ignored in the development of Android. This class is simple enough to parse HTML tag text into Normal style text. Let me take a look at the specific description of this class.

Class Structure:

Java.lang.Object

   ?

Android.text.Html

class overview:

This class is used to process the HTML string and convert it into a text that can be displayed. But not all HTML tags are supported.

Public method:

To say its simplicity is to have four methods for it:

tohtml (spanned  text)

< Span style= "font-family: Song body; Color: #222222 "> convert text to html .

TD valign= "Top" width= "style=" WIDTH:329.85PT; Border-top:none; Border-left:none; Border-bottom:solid White 1.0pt; Border-right:solid White 1.0pt; Background: #E2EFD9; padding:0cm 5.4pt 0cm 5.4pt ">

Public Methods

Static String

escapehtml (charsequence text)

Returns the Html escape character from the given representative name.

Static spanned

fromhtml (String Source)

Returns the text of the style that can be displayed from an Html string.

Static spanned

fromhtml (string  source,  Html.imagegetter  imagegetter,  Html.taghandler  taghandler)

Return the displayed style text from html string

static string


Method Description:

Public Static spanned fromhtml ( String Source, html.imagegetter imagegetter , html.taghandler taghandler)

Parameters:

source: A string containing HTML.

imagegetter: Imagegetter object. When the system resolves to the tag, it invokes the Getdrawable method of the Imagegetter object and passes the src attribute value to the incoming Getdrawable method. as for the specific meaning of the src attribute, it is determined in the Getdrawable method. The Getdrawable method returns a Drawable object. We can get image resources from res/drawable resources, assets resources, SD cards and the network, and divide into drawable objects.

taghandler: Taghandler object. The Handletag method of the object is called when the system does not process a label. However, this parameter is not commonly used. If not, it can be set to null.

To be Continued ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.