码迷,mamicode.com
首页 > 其他好文 > 详细

基本控件的使用

时间:2017-05-18 17:54:27      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:led   group   文件   文件夹   imageview   roi   enable   对象   androi   

2.Activity常用 的方法
View findViewById(int id) 根据组件的ID取得组件对象
setContentView(int layoutResID) 设置布局文件,设置显示组件
3.TextVies


android:maxLength="6" 允许最大字符数
android:textSize="100px" 文字大小
android:textStyle="bold" 文字样式
android:password="true" 是否以密文方法显示
android:layout_margin="100px" 外边距
android:background="@id(图片存放的文件夹名)/id(图片名)" 设置id的值
getText().toString() 获取空间的文本内容
setText(); 设置控件的文本内容
注意:<!-- -->注释
4.Button
5.EditText
android:enabled="false" 设置是否可用(false不可用)
6.RadioButton(单选按钮)
嵌入到RadioGroup中实现单选效果
android:checkedButton="radio的id值"
int getCheckedRadioButtonId();获得被选中的radiobutton的id
7.ImageView(图片空件)
android:src 图片资源ID
android:maxWidth 最大宽度
android:maxHeight 最大高度
android:adjustViewBounds 设置为true,则maxWidth和maxHeight生效
8.ImageButton(图片按钮)
9.TimePicker(时间控件)
viod updateDate(int year,int monthOfYear,int dayOfMonth)
注意:mothOfYear是从0-11表示1-12月
11.Spinner
11.1下拉列表项的配置方式
a.资源文件配置
第一步:在string.xml配置
<string-array name="citys">
list.add("湖南");
list.add("上海");
list.add("北京");
</string-array>
第二步:指定资源
android:entries="@arryay/citys";
b.适配器配置
第一种:资源配置
ArrayAdapter<CharSequence> adapter=
ArrayAdapter.createFromResource(
this,资源id, 列表显示的样式 );

第二种:资源配置
ArrayAdapter<CharSequence> adapte=
new ArrayAdapter<CharSequence>(
this,android.R.layout.simple_spinner_item,(列表显示的样式),list(集合数据);

基本控件的使用

标签:led   group   文件   文件夹   imageview   roi   enable   对象   androi   

原文地址:http://www.cnblogs.com/hewei-666/p/6874636.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!