Basic Components of Android 01-textview

Source: Internet
Author: User

Textview is one of our most commonly used components. It is mainly used to display text content. I believe you are very familiar with it, therefore, common attributes (such as setting the font size, color, text location, and so on) are not described here. The following lists the interesting attributes of textview, which I hope will help you.

1. Set click link
Android: autolink
This attribute is used to set whether the text is displayed as a clickable link when the text is URL link, email, phone number, or map. Optional values: none (common text, default value)/Web (URL, click to open the page)/email (email, click to send an email)/phone (phone number, click Open dialing Interface)/MAP/All.

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

Android: textcolorlink
Set the text link color.

2. Set drawable (image)
Android: drawableleft, Android: drawableright, Android: drawabletop, Android: drawablebottom
Output A drawable on the left, right, top, and bottom of the 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.

3. Set the width
Android: EMS, Android: minems, Android: maxems
Set textview width, minimum width, and maximum width. Unit: character (that is, width of n characters ).

4. Set the number of rows
Android: singleline
Set single row display.

Android: lines, Android: minlines, Android: maxlines
Set the number of lines of text, the minimum number of lines, and the maximum number of lines. Set the two lines to display two lines, even if the second row has no data.

5. Set row spacing
Android: linespacingextra
Set the line spacing.

Android: linespacingmultiplier
Set the line spacing multiple

6. Set shadow
Android: shadowcolor
Specifies the color of the text shadow, which must be used with shadowradius.

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: shadowdx, Android: shadowdy
Set the horizontal and vertical coordinates of the shadow.

7. Set ultra-long display
Android: ellipsize
Set how to display the control when the text is too long. The following settings are available: start -- ellipsis is displayed at the beginning; end -- ellipsis is displayed at the end; middle -- ellipsis is displayed in the middle; marquee -- is displayed in the form of a marquee (horizontal animation Movement)

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.