Android Interface Components-text box

Source: Internet
Author: User

The previous three articles are essentially centered around the view class. View is the base class for the Android UI, and our Android development "journey" starts with view.

The Android interface UI has a large number of components, which inherit and indirectly inherit from view. One type of component is basic, which is the TextView text box, which is the function of displaying text. On the basis of TextView, TextView derives: EditText checkedtextview Button digitalclock chronometer and other sub-class controls, strengthening the function of TextView. This section describes the TextView and EditText classes

A EditText

EditText Properties:

Android:autolink convert text to clickable hyperlink form, value: None Web email phone map All

Android:drawablebottom draws a picture below the text, and a similar property android:drawableleft android:drawabletop android:drawableright

Android:gravity shows how text is to be displayed

Android:inputtype text Input Form

Android:hint Tips

Android:textcolor text color

What to do: design hyperlink-style text with picture text, multiple lines of text

Read the XML to find the properties that set the text box effect above

<TextView Android:id="@+id/textview1"Android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:autolink="Email"Android:text="@string/mail"/> <TextView Android:id="@+id/textview2"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:drawablebottom="@drawable/ic_launcher"Android:text="@string/icon"/> <TextView Android:id="@+id/textview3"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:singleline="false"Android:text="@string/longtext"/>
Two edit boxes

The function of the edit box is to make text edits on the screen, which is actually a component that TextView open the text editing function. The special attributes of EditText are definitely related to text editing, and the related properties are as follows

EditText Properties:

Android:inputtype input text type, basic type has password, phone, etc. can be through CTRL +/view

Android:singleline whether single-line input

Actual operation: Make a registration interface

The relevant XML code is as follows, which is relatively simple

<tablelayout android:layout_width="match_parent"Android:layout_height="match_parent"> <TableRow Android:id="@+id/tablerow1"Android:layout_width="wrap_content"Android:layout_height="wrap_content"> <TextView Android:id="@+id/textview1"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Name:"/> <EditText Android:id="@+id/edittext1"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:ems="Ten"Android:inputtype="Textpersonname"> <requestfocus/> </EditText> </TableRow> <TableRow Android:id="@+id/tablerow2"Android:layout_width="wrap_content"Android:layout_height="wrap_content"> <TextView Android:id="@+id/textview2"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="is a rabbit password:"/> <EditText Android:id="@+id/edittext2"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:ems="Ten"/> </TableRow> <TableRow Android:id="@+id/tablerow3"Android:layout_width="wrap_content"Android:layout_height="wrap_content"> <TextView Android:id="@+id/textview3"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Confirm Password:"/> <EditText Android:id="@+id/edittext3"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:ems="Ten"/> </TableRow> <TableRow Android:id="@+id/tablerow4"Android:layout_width="wrap_content"Android:layout_height="wrap_content"> </TableRow> <Button Android:id="@+id/button1"Android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:text="Submit"/> </TableLayout>

Summary: The above is an Android basic text control for the interface text display.

the level is limited, please leave a message!

Android Interface Components-text box

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.