Learning about EditText in android (15) and androidedittext
EditText is very similar to TextVew. TextView is used to display text and does not input text. However, EditText can be used to input text. Next, let's look at the common attributes of EditText.
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 = "Enter ID"/> </LinearLayout> </span>
Android: layout_width = "fill_parent": Fill the width of the parent container
Android: layout_height = "wrap_content": height Package content
Android: layout_marginLeft = "8dp": 8dp to the left
Android: layout_marginRight = "8dp": distance from the right side to 8dp
Android: gravity = "center": center content
We use android: hint to specify the prompt information of the text box.
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>
Android: inputType = "numberPassword" is used to specify the input password.
InputType can specify many parameters. For example, number indicates a number box, and data indicates the input date;
The following uses background to customize some dazzling Effects
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 to green, and the width to 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 through Ren yugang'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:shape="rectangle" > <solid android:color="#ffffff" /> </shape> </item> <item android:bottom="6dp" android:top="6dp"> <shape android:shape="rectangle" > <solid android:color="#ffffff" /> </shape> </item> <item android:left="2dp" android:right="2dp" android:top="2dp" android:bottom="6dp"> <shape android:shape="rectangle"> <solid 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:
Reprinted please indicate the source: http://blog.csdn.net/hai_qing_xu_kong/article/details/42584999 sentiment control _