EditText圆角
2014-01-02 16:15
323 查看
首先定义一个圆角xml,路径:res/drawable/rounded_edittext.xml
[html] view
plaincopyprint?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF" />
<corners android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp" android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>
显示控件的xml中
[java] view
plaincopyprint?
<EditText android:id="@+id/edt_operator_name" style="@style/syncEditText"
android:hint="@string/hint_operator_name"
android:background="@drawable/rounded_edittext"
android:layout_width="250dip"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:gravity="center_vertical" />
其中关键的就是设置编辑文本控件的background属性为刚定义的圆角xml。
即:
[java] view
plaincopyprint?
android:background="@drawable/rounded_edittext"
[html] view
plaincopyprint?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF" />
<corners android:bottomRightRadius="15dp"
android:bottomLeftRadius="15dp" android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
</shape>
显示控件的xml中
[java] view
plaincopyprint?
<EditText android:id="@+id/edt_operator_name" style="@style/syncEditText"
android:hint="@string/hint_operator_name"
android:background="@drawable/rounded_edittext"
android:layout_width="250dip"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:paddingBottom="10dip"
android:gravity="center_vertical" />
其中关键的就是设置编辑文本控件的background属性为刚定义的圆角xml。
即:
[java] view
plaincopyprint?
android:background="@drawable/rounded_edittext"
相关文章推荐
- android 代码实现控件之间的间距
- 解決Linux下Android开发真机调试设备不被识别问题
- [Android]在代码里运行另一个程序的方法
- [软件咨询]WPS2012正式版已发布 金山Office移动版4.0发布
- Android笔记-Linux Kernel Ftrace (Function Trace)解析
- android USB如何修改VID具体实现
- Android Mouse实现过程详细笔记
- 深入Android Browser配置管理的详解
- Android Mms之:深入理解对话列表管理
- Android APP与媒体存储服务的交互
- android 多线程技术应用
- Android之采用execSQL与rawQuery方法完成数据的添删改查操作详解
- Android数据类型之间相互转换系统介绍
- 通过Android trace文件分析死锁ANR实例过程
- Android实现左右滑动效果的方法详解
- Android 各国语言缩写及简称详细介绍
- Android 自动判断是电话,网址,EMAIL方法之Linkify的使用
- android IPC之binder通信机制
- Android应用开发中模拟按下HOME键的效果(实现代码)
- Android 读写文件方法汇总