Follow me to learn the edittext of android-common controls

Source: Internet
Author: User

EditText is the direct subclass of TextView, which differs from TextView in that EditText can accept user input.

Here is an example to illustrate the use of edittext

Example: Sina Weibo login Interface (Note that since we have not yet touched buttons and picture controls, so button box pictures where we use TextView do)

First look at the Sina Weibo login page

Since I intercepted the iphone, the background of the Android version of Sina Weibo is not this one, so I changed the background map

The code is as follows

1 <?XML version= "1.0" encoding= "Utf-8"?>2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 Android:background= "@drawable/login_wallpaper1"6 android:orientation= "vertical" >7 8     <!--User Picture -9 Ten     <TextView One         Android:layout_width= "Wrap_content" A Android:layout_height= "Wrap_content" - android:layout_gravity= "Center_horizontal" - Android:layout_marginbottom= "10DP" the Android:layout_margintop= "20DP" - Android:background= "@drawable/login_profile_default" /> -     <!--user name and password input box, using nested layouts - -  +     <LinearLayout -         Android:layout_width= "Match_parent" + Android:layout_height= "Wrap_content" A Android:layout_margin= "10DP" at Android:background= "@drawable/fast_select_merchant_input_bg" - android:orientation= "vertical" > -  -         <EditText -             Android:id= "@+id/et_user" - Android:layout_width= "Match_parent" in Android:layout_height= "Wrap_content" - Android:background= "@null" to Android:drawableleft= "@drawable/login_user" + android:drawablepadding= "15DP" - Android:hint= "Email/mobile number" the android:padding= "10DP" /> *         <!--Split Line - $ Panax Notoginseng         <View -             Android:layout_width= "Match_parent" the Android:layout_height= "1DP" + Android:background= "@android: Color/darker_gray" /> A  the         <EditText +             Android:id= "@+id/et_pwd" - Android:layout_width= "Match_parent" $ Android:layout_height= "Wrap_content" $ Android:background= "@null" - Android:drawableleft= "@drawable/login_key" - android:drawablepadding= "15DP" the Android:hint= "Please enter password" - Android:inputtype= "Textpassword"Wuyi android:padding= "10DP" /> the     </LinearLayout> -     <!--Impersonation Login Button - Wu  -     <TextView About         Android:layout_width= "Match_parent" $ Android:layout_height= "Wrap_content" - Android:layout_margin= "10DP" - Android:background= "#006400" - android:gravity= "Center" A android:padding= "10DP" + Android:text= "Login" the Android:textcolor= "#F8F8FF" - android:textsize= "30SP" /> $  the </LinearLayout>
View Code


Layouts can be nested, and in this login page my input box section takes a nested linear layout.

You can preview the effect.

Follow me to learn the edittext of android-common controls

Related Article

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.