Android EditText controls

Source: Internet
Author: User

<edittext
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
Android:maxlength= "4"//Limit the number of words we enter

Android:singleline= "true"//limit us whether the input box is full after a newline, true means no line break
Android:inputtype= "number"//limit our input data type, numbers only indicate input digits

Android:hint= "Only allow input number"//In the input box to prompt us to enter the information

android:drawableleft= "@drawable/title"//on the left of the text box, a picture named title is displayed, and the picture is copied to drawable in advance title.jpg

/>

Change the shape of the input box

1. Create a new shape.xml in drawable and put the following code

<?xml version= "1.0" encoding= "UTF-8"?>
<shape xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:shape= "Rectangle" >
<!--fill Color-
<solid android:color= "#FFFFFF"/>
<!--set the Four corners of the rectangle to arc--
<!--Android:radius Arc radius--
<corners android:radius= "7dip"/>
</shape>

2, add in the Main.xml<edittext

android:background= "@drawable/shape"

Android EditText controls

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.