Android Basic UI Chapter------TextView and its subclasses

Source: Internet
Author: User

First, TextView inherits from the view class, is essentially a text editor, just android off its editing function. The function of editing text is given to its subclass--edittext.

The Special place:
1. By setting the Ellipsize=marquee, you can achieve "marquee"
Android:width= "Wrap_content"
Android:focusable = "true"
Android:singleline = "true"
Android:ellipsize= "Marquee"
Android:focusableintouchmode= "true"

2. You can set the text with the link through Autolink. Type of support:
e-mail \ phone \ URL (email\phone\web)

Second, EditText is the TextView subclass. The biggest difference: You can accept user input.
Important attributes:
InputType type of data entered
Hint the prompt in the input box
Selectallonfocus whether to select all when getting focus

Special CONTROLS:
Autocompletetextview with auto-complete function edittext
Google engineers give it a name when the heart ~ ~ ^_^ #

Third, Button is the subclass of TextView, when the user clicks the onclick () trigger

Special Features: Use selector to modify backgrounds in different states.
Under the drawable directory, create a selector file.

<item android:state_pressed="false"      android:drawable="***"></item>

Iv. RadioButton and Checkboxes

Same point: It's more than a button. A feature that can be selected
One more checked attribute

Different points: RadioButton for more than one, was radiogroup wrapped
Checkboxes can be selected multiple

Five, State switch ToggleButton

Special properties:
android:checked Sets whether the button is selected
Android:texton setting the text in the open state
Android:textoff setting the text in the off state

Six, timer chronometer
Android:format setting the timing format of the timer

Method:
SetBase (long base) sets the start time of the timer
SetFormat (String format) sets the format for displaying time
Start () Begin timing
Stop () stops timing
Setonchronometerticklistener event Listener, which is triggered when time changes

^_^ # Tease me yesterday with the TimerTask realized the chronograph function, the error is very big ... After a period of time to study the source code, see how chronometer is realized ~ ~

Copyright notice: Just out of the original content of the pot, I hope you have help ~

Android Basic UI Chapter------TextView and its subclasses

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.