Tagged with: Android Android tutorial Android development EditText Layout
EditText it is very similar to Textvew, TextView is used to display text, and does not enter the text function, but edittext can input text, next we look at EditText commonly used properties
Effect 1:
<span style= "FONT-SIZE:18PX;" ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "match _parent " android:layout_height=" match_parent " android:background=" #ffffff " android:orientation=" Vertical " android:gravity=" center "> <edittext android:id=" @+id/tv_weixin " android:layout _width= "Fill_parent" android:layout_height= "wrap_content" android:layout_marginleft= "8DP" Android : layout_marginright= "8DP" android:gravity= "center" android:hint= "Please enter ID"/></linearlayout> </span>
Android:layout_width= "fill_parent": Width fills parent container
Android:layout_height= "wrap_content": Height package content
Android:layout_marginleft= "8DP": distance from left to 8DP
Android:layout_marginright= "8DP": 8DP from right margin
android:gravity= "Center": Content centered
We use Android:hint to specify the text box's prompt information
Effect 2:
<span style= "FONT-SIZE:18PX;" > <edittext android:id= "@+id/tv_weixin" android:layout_width= "fill_parent" android:layout_ height= "Wrap_content" android:layout_marginleft= "8DP" android:layout_marginright= "8DP" android: gravity= "center" android:inputtype= "Numberpassword"/></span>
To specify a digital password by android:inputtype= "Numberpassword"
InputType can specify many parameters, such as: number is a numeric box; Data indicates the date entered;
The following background to customize some of the more dazzling effect
1.
<span style= "FONT-SIZE:18PX;" ><edittext android:id= "@+id/tv_weixin" android:layout_width= "fill_parent" android:layout_ height= "30DP" android:layout_marginleft= "8DP" android:layout_marginright= "8DP" android:gravity= " Center " android:background=" @drawable/weixin3 "/></span>
weixin3 File:
<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "http://schemas.android.com/apk/res/ Android "> <solid android:color=" #0000 "/> <stroke android:width=" 3DP " android:color=" #3f5 "/></shape></span>
The effect is as follows: Set the background color to transparent, the border is green, width 3DP
2. Set the above background property to the following file
<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <item> <shape android:shape= "Rectangle" > <solid android:color= "#0ac39e"/ > </shape> </item> <item android:left= "2DP" android:right= "2DP" android: bottom= "2DP" > <shape android:shape= "Rectangle" > <solid android:color= "#ffffff"/> </shape> </item> <item android:bottom= "6DP" > <shape android:shape= "Rectangle "> <solid android:color=" #ffffff "/> </shape> </item></layer-list>< /SPAN>
The effect is as follows (this effect is via Ningyugang's blog (http://blog.csdn.net/singwhatiwanna/article/details/42215847))
3.
<span style= "FONT-SIZE:18PX;" ><?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <item> <shape android:shape= "Oval" > <solid android:color= "#0ac39e"/> ; </shape> </item> <item android:top= "6DP" android:bottom= "6DP" > <shape Android:sha Pe= "Rectangle" > <solid android:color= "#ffffff"/> </shape> </item> <item Android:bottom= "6DP" android:top= "6DP" > <shape android:shape= "Rectangle" > <solid and Roid:color= "#ffffff"/> </shape> </item> <item android:left= "2DP" android:right= "2DP "Android:top=" 2DP "android:bottom=" 6DP "> <shape android:shape=" Rectangle "> <s Olid android:color= "#ffffff"/> </shape> </item> <item android:left= "2DP" android:right= "2DP" android:top= "6DP" android:bottom= "2DP" > <shape android:shape= "Rectangle" > <solid android:color= "#ffffff"/> </shape> </item></layer-list></span>
The effect is as follows:
Reprint Please specify the Source: http://blog.csdn.net/hai_qing_xu_kong/article/details/42584999 Emotional Control _
Learn about the various uses of Android EditText (15)