EditView控件的用法及总结
2012-08-28 09:48
337 查看
activity_main.xml中的代码内容如下:
<EditText
android:layout_height="40dp"
android:layout_width="wrap_content"
android:textColor="@color/color" //边框的颜色
android:hint="请输入内容" //提醒内容,如果设置text,输入内容的时候提醒的内容不会自动消失
android:maxLength="11" //设置EditView的最大的输入长度
android:singleLine="true" //输入内容是单行还是多行,如果是false的话就表示是可以输入多行
android:inputType="phone" //输入的内容是电话类型的,也可以选择其他的类型
android:drawableLeft="@drawable/ic_launcher" //给EditView上添加图片,drawleft表示图片位于editView 的左边
android:background="@drawable/shap" //给EditView设置圆角 ,引用的是res\drawable-hdpi\shape.xml下的shape代码
/>
res\drawable-hdpi\shape.xml下的代码
<?xml version="1.0" encoding="UTF-8"?>
<!-- 必须要的shap的类型 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- 填充editView的颜色 -->
<soild android:color="#ffffff"/>
<!-- 设置圆角的弧度,radius半径越大,editView的边角越圆 -->
<corners android:radius="20dp"/>
</shape>
<EditText
android:layout_height="40dp"
android:layout_width="wrap_content"
android:textColor="@color/color" //边框的颜色
android:hint="请输入内容" //提醒内容,如果设置text,输入内容的时候提醒的内容不会自动消失
android:maxLength="11" //设置EditView的最大的输入长度
android:singleLine="true" //输入内容是单行还是多行,如果是false的话就表示是可以输入多行
android:inputType="phone" //输入的内容是电话类型的,也可以选择其他的类型
android:drawableLeft="@drawable/ic_launcher" //给EditView上添加图片,drawleft表示图片位于editView 的左边
android:background="@drawable/shap" //给EditView设置圆角 ,引用的是res\drawable-hdpi\shape.xml下的shape代码
/>
res\drawable-hdpi\shape.xml下的代码
<?xml version="1.0" encoding="UTF-8"?>
<!-- 必须要的shap的类型 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- 填充editView的颜色 -->
<soild android:color="#ffffff"/>
<!-- 设置圆角的弧度,radius半径越大,editView的边角越圆 -->
<corners android:radius="20dp"/>
</shape>
相关文章推荐
- Android开发之TextView控件用法实例总结
- Android控件用法总结之EditText
- android基础控件EditView用法介绍
- Vc控件用法总结之List Control
- 【UI控件总结】【UIScrollView】深入理解篇UIScrollerView
- Android编程开发之TextView控件用法(2种方法)
- Swift - 图像控件(UIImageView)的用法
- 自定义View之自定义EditText带删除内容按钮控件
- vc中edit控件使用总结
- ASP.NET-----Repeater数据控件的用法总结
- android学习之LayoutInflater的用法,在myAdapter getView()里将多个TextView组件压缩成一个View控件,并在listView里显示
- iOS UIActivityIndicatorView(指示控制器)用法总结
- ImageView: ScaleType用法总结
- 在android开发中遇到的WebView控件相应的总结
- (VIEW控件)PullToRefreshExpandableListView的用法
- 强大的滚动控件——RecyclerView(一)基本用法
- WebBrowser控件用法总结
- WebView控件之WebSettings各种配置方法源码总结
- 《第一行代码-Android》学习笔记(二十一)WebView控件总结【修改】
- iphone中UITableView的用法总结