Interface Optimization processing technology (2) Editing text box component optimization processing and text box Components
Development steps:
- Create an xml file under drawable under res
- Add a label to set the Display Effect
1 <?xml version="1.0" encoding="utf-8"?>2 <shape xmlns:android="http://schemas.android.com/apk/res/android" >3 <corners android:radius="8dp"/>4 <solid android:color="#FFFFFF"/>5 <stroke android:width="0.5dp" android:color="#CCCCCC"/>6 </shape>
- Set the background attribute for the layout file tag
1 // activity_login.xml 2 3 <EditText 4 android: id = "@ + id/txtAccount" 5 android: layout_width = "fill_parent" 6 android: layout_height = "35dp" 7 android: hint = "Enter the account:" 8 android: textSize = "12sp" 9 android: textColor = "#000000" 10 android: background = "@ drawable/txt_bg" 11 android: paddingLeft = "10dp"/> 12 <EditText13 android: id = "@ + id/txtPassword" 14 android: layout_width = "fill_parent" 15 android: layout_height = "35dp" 16 android: hint = "enter the password:" 17 android: textSize = "12sp" 18 android: textColor = "#000000" 19 android: inputType = "textPassword" 20 android: background = "@ drawable/txt_bg" 21 android: paddingLeft = "10dp" 22 android: layout_marginTop = "10dp"/>
Run:
Summary:The differences between the optimization of the edit text box and the Button optimization are that the Button must be in two states, while EditText only needs one state.