XML attributes supported by TextView and related methods

Source: Internet
Author: User

XML properties

Related methods

Description

Android:autolink

Setautolinkmask (int)

Convert formatted text to a clickthrough form that can be clicked

Android:autotext

Setkeylistener (KeyListener)

Controls whether connections such as URLs, e-mail addresses, and so on, are automatically converted to links that can be clicked

Android:capitalize

Setkeylistener (KeyListener)

Controls whether user-entered text is converted to a thank-you letter. This property supports the following property values:

None: Do not convert

sentences: Capitalize the first letter of each sentence

words: Capitalize the first letter of each word

characters: Each letter is capitalized

Android:cursorvisible

Setcursorvisible (Boolean)

Sets whether the cursor of the text box is visible

Android:digits

Setkeylistener (KeyListener)

If this property is set to True, the text box corresponds to a numeric input method, and only those valid characters are accepted

Android:drawablebottom

Setcompounddrawableswithintrinsicbounds (drawable, drawable, drawable, drawable)

Draws the specified image at the bottom of the text within the text box

Android:drawableend

Draws the specified image at the end of the text within the text box

Android:drawableleft

Setcompounddrawableswithintrinsicbounds (drawable, drawable, drawable, drawable)

Draws the specified image to the left of the text inside the text box

Android:drawablepadding

Setcompounddrawableswithintrinsicbounds (drawable, drawable, drawable, drawable)

Spacing between text and graphics within a text box

Android:drawableright

Setcompounddrawableswithintrinsicbounds (drawable, drawable, drawable, drawable)

Draws the specified image to the right of the text inside the text box

Android:drawablestart

Draws the specified image at the beginning of the text within the text box

Android:drawabletop

Setcompounddrawableswithintrinsicbounds (drawable, drawable, drawable, drawable)

Draws the specified image at the top of the text within the text box

Android:editable

Sets whether the text allows editing

Android:ellipsize

Setellipsize (Textuitls.truncateat)

Sets how text content is handled when the displayed text exceeds the length of the TextView. This property supports the following property values:

None: Do not do any processing

start: Truncated at the beginning of text and displays ellipses

Middle: truncates in middle of text and displays ellipses

End: Truncates at the end of text and displays ellipses

marquee: Displaying text using marquee scrolling animation

Android:ems

Setems (int)

Sets the width of the component, in EM units

Android:fontfamily

Settypeface (int)

Set the font for text inside the text box

Android:gravity

setgravity (int)

Set the alignment of text within the text box

Android:height

setheight (int)

Sets the height of the text box (in pixel)

Android:hint

Sethint (int)

Sets the prompt text that is displayed by default in the text box when the contents of the text box are empty

Android:imeactionid

Setimeactionlabel (Charsequence, int.)

Provides a Editorinfo.actionid value for the input method when the text box is associated with an input method

Android:imeactionlabel

Setimeactionlabel (Charsequence, int.)

Provides a Editorinfo.actionlabel value for the input method when the text box is associated with an input method

Android:imeoptions

setimeoptions (int)

Provides additional options for IME when the text box is associated with an input method

Android:includefontpadding

Setincludefontpadding (Boolean)

Sets whether to reserve enough space for the font. The default value is True

Android:inputmethod

Setkeylistener (KeyListener)

Specify a specific input method for the text box. The attribute value is the fully qualified class name of the input method

Android:inputtype

Setrawinputtype (int)

Specifies the type of the text box. This property is somewhat similar to the Type property of the <input.../> element in HTML. This property supports a large number of property values, and different property values are used to specify a specific input box

Android:linespacingextra

Setlinespacing (float, float)

Controls the extra spacing between two lines of text. Used in conjunction with the Android:linespacingmultiplier property

Android:linespacingmultiplier

Setlinespacing (float, float)

Controls the extra spacing between two lines of text. Each line of text is height * This property value + Android:linespacingextra property value

Android:lines

Setlines (int)

Set the text box to a few lines by default

Android:linksclickable

Setlinksclickable (Boolean)

Controls whether the URL of the text box, e-mail, and other links can be clicked

Android:marqueerepeatlimit

Setmarqueerepeatlimit (int)

Set the number of times the marquee animation repeats

Android:maxems

Setmaxems (int)

Specifies the maximum width of the text box (in EM)

Android:maxheight

Setmaxheight (int)

Specifies the maximum height of the text box (in pixel)

Android:maxlength

SetFilters (Inputfilter)

Sets the maximum character length for this text box

Android:maxlines

Setmaxlines (int)

Set this text box up to a few lines

Android:maxwidth

Setmaxwidth (int)

Specifies the maximum width of the text box (in pixel)

Android:minems

Setminems (int)

Specifies the minimum width of the text box (in EM)

Android:minheight

SetMinHeight (int)

Specifies the minimum height of the text box (in pixel)

Android:minlines

Setminlines (int)

Set this text box at least a few lines

Android:minwidth

Setminwidth (int)

Specifies the minimum width of the text box (in pixel)

Android:numeric

Setkeylistener (KeyListener)

Sets the numeric input method associated with the text box. This property supports the following property values:

integer: Specifying an associative integer input method

signed: A numeric input method that allows entering symbols

decimal: A numeric input method that allows you to enter a decimal point

Android:password

Settransformationmethod (Transformationmethod)

Set this text box to be a password box (with dots in place of characters)

Android:phonenumber

Setkeylistener (KeyListener)

Set this text box to accept only phone numbers

Android:privateimeoptions

Setprivateimeoptions (Boolean)

Set private options for the input method that the text box is associated with

Android:scrollhorizontally

Sethorizontallyscrolling (Boolean)

Whether horizontal scrolling is allowed when the text box is not sufficient to display all content

Android:selectallonfocus

Setselectallonfocus (Boolean)

If the contents of the text box are selectable, set whether all text is automatically selected when it gets focus

Android:shadowcolor

Setshadowlayer (float, float, float, float)

Set the shadow color of text within a text box

Android:shadowdx

Setshadowlayer (float, float, float, float)

Sets the offset of the shadow of text within the text box horizontally

Android:shadowdy

Setshadowlayer (float, float, float, float)

Sets the offset of the text in the text box in the vertical direction of the shadow

Android:shadowradius

Setshadowlayer (float, float, float, float)

Sets the degree of blurring of the shadow of text within the text box. The larger the value, the more blurred the shadow

Android:singleline

Settransformationmethod

Sets whether the text box is single-line mode. If set to True, the text box does not wrap

Android:text

SetText (charsequence)

Set the contents of text inside a text box

Android:textallcaps

Setallcaps (Boolean)

Sets whether to display all letters of the text box as uppercase letters

Android:textappearance

Set the color, font, size, and style of the text box

Android:textcolor

SetTextColor (Colorstatelist)

Set the color of text in a text box

Android:textcolorhighlight

Sethighlightcolor (int)

Sets the color of text in a text box when it is selected

Android:textcolorhint

Sethinttextcolor (int)

Set the color of the hint text in a text box

Android:textcolorlink

Setlinktextcolor (int)

Set the color of a link in a text box

Android:textisselectable

Istextselectable ()

Sets whether text in a text box can be selected when the text box cannot be edited

Android:textscalex

Settextscalex (float)

Set the zoom factor for the text in the text box in the horizontal direction

Android:textsize

Settextsize (float)

Set the font size of text within a text box

Android:textstyle

Settypeface (Typeface)

Sets the font style of text within a text box, such as bold, italic, and so on

Android:typeface

Settypeface (Typeface)

Set the font style for text within a text box

Android:width

SetWidth (int)

Sets the width of the text box (in pixel)

XML attributes supported by TextView and related methods

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.