Android Learning Note (2) EditText Control Learning

Source: Internet
Author: User

Fifth lesson for Joshui teacher


One, set an input box
To add a control:

<edittext        android:layout_width= "fill_parent"        android:layout_height= "Wrap_content"        android: layout_margintop= "52DP"    <!--the distance of the top of the control from the previous control--        

Two, eliminate the focus of the input box
method One:
<edittext        android:layout_width= "0DP"        android:layout_height= "0DP"        android:layout_margintop= "52DP "        />   <edittext        android:layout_width=" fill_parent "        android:layout_height=" Wrap_content "        android:layout_margintop= "52DP"        />
Method Two:
<edittext        android:layout_width= "fill_parent"        android:layout_height= "Wrap_content"        android: layout_margintop= "52DP"              >    <requestfocus/>

third, limit the input content and length
        Android:maxlength= "3"        android:inputtype= "number"

Four. Set Prompt information
android:hint= "Input three digits"

Five. Add a picture to the input box
Put the picture tubiao.jpgandroid:drawableleft= "@drawable/tubiao" in drawable-mdpi

Six, turn the input box to rounded corners

Set up file Shape.xml in drawable-mdpi: <shape xmlns:android= "Http://schemas.android.com/apk/res/android"    Android:shape= "Rectangle" >    <solid        android:color= "#e2e2e2" >    </solid>    <corners        android:radius= "7DP"        <!--set radians--        android:topleftradius= "5DP"        android:toprightradius= " 5DP ">    </corners></shape>

attached Shortcut keys in eclipse

Android Layout properties, Tag Properties Summary

EditText Properties of Android development

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Learning Note (2) EditText Control Learning

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.