Android2.2 API Chinese Document Series (1)-textview

Source: Internet
Author: User

 

    Like the gadgets in a mechanical maze game-every widget is a useful tool in our hands. Due to time issues, you can learn its basic usage for the moment, however, you only need to learn it from the system at a time. At least you need to know that there is such an attribute and there is such a method, so that you can play a key role in some problems. Only by fully understanding it can you use it freely.

    Source: farmer UNCLE: http://www.cnblogs.com/over140/

    Body

    I. textview API Chinese Document

    1.1 Structure

    Java. Lang. Object
    Using Android. View. View
    Using Android. widget. textview

    Direct subclass:

    Button, checkedtextview, chronometer, digitalclock, edittext

    Indirect subclass:
    Autocompletetextview, checkbox, compoundbutton, extractedittext, multiautocompletetextview, radiobutton, togglebutton

    1.2 API

     

    Attribute name

    Description

    Android: autolink

    Set whether to display clickable links when the text is URL link, email, phone number, or map. Optional values (None/web/email/phone/MAP/All)

    Android: AutoText

    If this parameter is set, the spelling of the input value is automatically corrected. There is no effect here. It works when the input method is displayed and entered.

    Android: buffertype

    Specifies the text category obtained by gettext. The editable option is similar to the append character of stringbuilder,

    That is to say, after gettext, you can use the append method to set the text content. Spannable can use styles in a given character area. For more information, see 1. 2.

    Android: Capitalize

    Set uppercase letters. There is no effect here. The input method needs to pop up to see it. For details, see edittext.

    Android: cursorvisible

    Set the cursor to show/hide. The cursor is displayed by default.

    Android: digits

    Specifies the characters that can be entered. For example, "1234567890. +-*/%/N ()"

    Android: drawablebottom

    Output A drawable in the lower part of text. If a color is specified, the background of the text is set to this color, and the latter is overwritten with the background.

    Android: drawableleft

    Output A drawable on the left of text.

    Android: drawablepadding

    Set the interval between text and drawable. It can be used with drawableleft, drawableright, drawabletop, and drawablebottom. It can be set to negative.

    Android: drawableright

    Output A drawable on the Right of text.

    Android: drawabletop

    Output A drawable on the top of the text.

    Android: editable

    Set whether to edit. No effect. For more information, see editview.

    Android: editorextras

    Set additional input data for text. We will discuss it again in editview.

    Android: ellipsize

    Set how to display the control when the text is too long. You can set the following values: "Start" -- ellipsis () at the beginning, "end" -- ellipsis () at the end, and "Middle" -- ellipsis () in the middle; "marquee"-displayed as a marquee (horizontal movement of the animation)

    Android: freezestext

    Set the content of the saved text and the cursor position. See: Here.

    Android: gravity

    Set the text location. For example, if it is set to "center", the text is displayed in the center.

    Android: hint

    Text prompt information displayed when text is empty. You can use textcolorhint to set the color of the prompt information. This attribute is used in editview, but it can also be used here.

    Android: imeoptions

    Additional function: sets the actions related to the ime action and the edit box in the lower-right corner. For example, a "finish" is displayed in the lower-right corner of actiondone, without setting a carriage return symbol by default. This is described in detail in edittext, Which is useless here.

    Android: imeactionid

    Set the ime action ID. Let's explain it again in edittext. You can read this post first: Here.

    Android: imeactionlabel

    Set the ime action label. Describe it in edittext.

    Android: includefontpadding

    Set whether the text contains additional white space at the top and bottom. The default value is true.

    Android: inputmethod

    Specify the Input Method for text. You must specify the full package name ). For example, Com. Google. Android. inputmethod. Pinyin, but the error cannot be found.

    Android: inputtype

    Set the text type to help the input method display the appropriate keyboard type. It is described in detail in edittext, and there is no effect here.

    Android: linksclickable

    Set whether to click the connection even if autolink is set.

    Android: marqueerepeatlimit

    When ellipsize specifies marquee, it sets the number of repeated scrolling times. When it is set to marquee_forever, it indicates unlimited times.

    Android: EMS

    Set textview width to n characters. The test here is a Chinese character width,

    Android: maxems

    Set the textview width to a maximum of n characters. Overwrite the EMS option when used with EMS.

    Android: minems

    Set textview width to the width of n characters at the minimum. Overwrite the EMS option when used with EMS.

    Android: maxlength

    Limit the length of the displayed text. The excess part is not displayed.

    Android: Lines

    Set the number of lines of text, and set the two lines to display the two lines, even if the second row has no data.

    Android: maxlines

    Set the maximum number of lines displayed in the text, which is used in combination with width or layout_width. If the line exceeded is automatically wrapped, the line exceeded is not displayed.

    Android: minlines

    Set the minimum number of lines of text, similar to lines.

    Android: linespacingextra

    Set the line spacing.

    Android: linespacingmultiplier

    Set the line spacing multiple. For example, "1.2"

    Android: Numeric

    If this parameter is set, the textview has a numeric input method. This is useless. The only effect after setting is that textview has a click effect. This attribute is described in detail in edittext.

    Android: Password

    Show text in small dots "."

    Android: phonenumber

    Set it to the telephone number input method.

    Android: privateimeoptions

    It is useless to set the input method options, which will be further discussed in edittext.

    Android: scrollhorizontally

    Set whether to display a horizontal bar when the text exceeds the textview width.

    Android: selectallonfocus

    If the text is selectable, let him get the focus instead of moving the cursor to the start or end of the text. It is ineffective after being set in edittext.

    Android: shadowcolor

    Specifies the color of the text shadow, which must be used with shadowradius. Effect:

    Android: shadowdx

    Set the start position of the Shadow horizontal coordinate.

    Android: shadowdy

    Set the start position of the Shadow vertical coordinate.

    Android: shadowradius

    Set the shadow radius. If it is set to 0.1, it becomes the font color. Generally, it is better to set it to 3.0.

    Android: singleline

    Set single row display. If it is used with layout_width, when the text cannot be fully displayed, "…" is used later. . For example, Android: text = "test _ singleline" Android: singleline = "true" Android: layout_width = "20dp" only displays "T ...". If singleline is not set or is set to false, the text will wrap automatically.

    Android: Text

    Set the display text.

    Android: textappearance

    Set the text appearance. Such as "? Android: ATTR/textappearancelargeinverse

    "Here is a built-in system appearance ,? Indicates whether the system has this appearance. Otherwise, the default appearance is used. Configurable values: textappearancebutton/textappearanceinverse/textappearancelarge/textappearancelargeinverse/textappearancemedium/combine/textappearancesmall/textappearancesmallinverse

    Android: textcolor

    Set text color

    Android: textcolorhighlight

    The background color of the selected text. The default color is blue.

    Android: textcolorhint

    Set the color of the prompt text. The default value is gray. Used with hint.

    Android: textcolorlink

    Text Link color.

    Android: textscalex

    Set the text interval. The default value is 1.0f. Set 0.5f/1.0f/1.5f/2.0f respectively. The effect is as follows:

    Android: textsize

    Set the text size. The recommended measurement unit is "SP", for example, "15sp"

    Android: textstyle

    Set one or more [bold (BOLD) 0, italic (italic) 1, and bolditalic (bold and oblique) 2] separated by "| ".

    Android: Typeface

    Set the text font, which must be one of the following constant values: normal 0, sans 1, Serif 2, monospace (same width font) 3]

    Android: Height

    Sets the height of the text area. supported measurement units: Px (pixels)/DP/SP/In/mm (mm)

    Android: maxheight

    Set the maximum height of the text area

    Android: minheight

    Set the minimum height of the text area

    Android: width

    Set the width of the text area. The unit of measurement is PX (pixel)/DP/SP/In/mm (mm). The difference between the Unit and layout_width is shown here.

    Android: maxwidth

    Set the maximum width of the text area

    Android: minwidth

    Set the minimum width of the text area

    1.3 additional instructions

    1.3.1 The following attributes and input methods have no effect here. Additional instructions will be provided in edittext.

    Android: Numeric/Android: digits/Android: phonenumber/Android: inputmethod/Android: Capitalize/Android: AutoText

    1.4 download an API document in Word format

    Http://download.csdn.net/source/2649980

    Ii. Example

    2.1 running horse lights

    Http://www.cnblogs.com/over140/archive/2010/08/20/1804770.html

    End

    Since no complete Android API Chinese documents have been published yet, I will continue to translate them to other organizations or official documents for the complete API Chinese. Here, I would like to thank my girlfriend for your support and help and provide me with Japanese-to-Chinese Translation (Translating Android API Japanese into Chinese) and English-to-Chinese translation; thanks to translation tools, search engines, and other sharer who provide translation reference for some attributes. Thank you for your support!

Reprinted: http://tech.srcsky.com/ OS /embeddedsystems/421880.html

 

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.