界面优化处理技术之(二)编辑文本框组件优化处理

开发步骤:

  • 在res下drawable下创建xml文件
  • 添加标签设置显示效果
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>

 

  • 布局文件标签设置background属性
 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="请输入帐号:"
 8                     android:textSize="12sp"
 9                     android:textColor="#000000"
10                     android:background="@drawable/txt_bg"
11                     android:paddingLeft="10dp"/>
12                 <EditText
13                     android:id="@+id/txtPassword"
14                     android:layout_width="fill_parent"
15                     android:layout_height="35dp"
16                     android:hint="请输入密码:"
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"/>

 

运行:

小结:编辑文本框的优化和按钮优化的不同之处在于,不用而直接用,原因是Button须两种状态,而EditText只需一种状态。

posted @ 2015-12-23 09:31  阿兰德鱼  阅读(348)  评论(0编辑  收藏  举报