安卓开发10:常用控件-常用表单级别控件
来源:互联网 发布:笑傲江湖 数据库 修改 编辑:程序博客网 时间:2024/06/06 08:42
常用表单级别控件:
<!-- 相对位置布局总体框架 --><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- 点击按钮 --> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <!-- 图片按钮 --> <ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/button1" android:src="@drawable/baidu_jgylogo3" /> <!-- 输入框 --> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/imageButton1" android:ems="10" > <requestFocus /> </EditText> <!-- 复选框 --> <CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/editText1" android:layout_marginTop="28dp" android:text="CheckBox1" /> <CheckBox android:id="@+id/checkBox2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/checkBox1" android:layout_alignParentRight="true" android:layout_marginRight="35dp" android:text="CheckBox2" /> <!-- 单选框 --> <RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="200dp" > <RadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="RadioButton1" /> <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="RadioButton2" /> <RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="RadioButton3" /> </RadioGroup> <!-- 图片 --> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="76dp" android:layout_toRightOf="@+id/button1" android:src="@drawable/caipiao_1" /></RelativeLayout>
效果图:
EditText常用属性:
android:layout_gravity="center_vertical"//设置控件显示的位置:默认top,这里居中显示,还有bottom
android:hint="请输入数字!"//设置显示在控件上的提示信息,控件上无值时显示
android:numeric="integer"//设置只能输入整数,如果是小数则是:decimal
android:singleLine="true"//设置单行输入,一旦设置为true,则文字不会自动换行。
android:gray="top"//多行中指针在第一行第一位置et.setSelection(et.length());//调整光标到最后一行
android:autoText//自动拼写帮助
android:capitalize//首字母大写
android:digits//设置只接受某些数字
android:singleLine//是否单行或者多行,回车是离开文本框还是文本框增加新行
android:numeric//只接受数字
android:password//密码
android:phoneNumber// 输入电话号码
android:editable//是否可编辑
android:autoLink=”all”//设置文本超链接样式当点击网址时,跳向该网址
android:password="true"//设置只能输入密码
android:textColor= "#ff8c00"//字体颜色
android:textStyle="bold"//字体,bold,italic, bolditalic
android:textSize="20dip"//大小
android:capitalize= "characters"//以大写字母写
android:textAlign="center"//EditText没有这个属性,但TextView有
android:textColorHighlight="#cccccc"//被选中文字的底色,默认为蓝色
android:textColorHint="#ffff00"//设置提示信息文字的颜色,默认为灰色
android:textScaleX="1.5"//控制字与字之间的间距
android:typeface="monospace"//字型,normal,sans, serif, monospace
android:background="@null"//空间背景,这里没有,指透明
android:layout_weight="1"//权重在控制控 件显示的大小时蛮有用的。
android:textAppearance="?android:attr/textAppearanceLargeInverse"//文字外观,这里引用的是系统自带的一个外观,?表示系统是否有这种外观,否则使用默认的外观。
- 安卓开发10:常用控件-常用表单级别控件
- 安卓开发10:常用控件
- 安卓常用控件
- 安卓常用控件一
- 安卓开发09:常用控件-TextView文本展示
- 安卓常用UI控件的属性
- 安卓常用布局控件、监听器总结
- 安卓 第三章 常用的控件
- 常用的安卓布局控件收藏
- 微信小程序常用表单控件
- iPhone 开发常用控件
- ios 开发常用控件
- 表单及表单中常用的控件
- Android 开发:(三)安卓常用控件以及仿《微门户》登录界面实现
- 常用表单控件简介及其使用
- jQuery操作表单常用控件方法小结
- android的常用控件总结【安卓入门五】
- 安卓常用控件--textView 的特性和演变
- java 线程关闭小结
- CentOS6.4关闭触控板
- 高级育婴师告诉你
- 【Windows7不要关闭的9个服务】
- 轻松学MVC4.0–6 MVC的执行流程
- 安卓开发10:常用控件-常用表单级别控件
- WPF 3D编程MeshGeometry3D类学习
- 织梦开启调试模式
- 利用 jQuery 將 DOM 元素聚焦 focus() 的六個版本
- Android onKeyUp事件 实现连续点击两次退出程序
- Spring2.5教程:2、搭建与测试Spring的开发环境
- opencv 学习第二天 学习opencv(中文版)对一幅图片进行canny边缘检测
- python 字典
- 调用第三方库crash异常捕获android