何、

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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(集合数据);

posted on 2017-05-18 17:38  何、  阅读(170)  评论(0编辑  收藏  举报