Activity的常用控件

 

TimerPick(时间控件)
public Integer getCurrentHour() //返回当前设置的小时
public Integer getCurrentMinute()//返回当前设置的分钟
public boolean is24HourView() //判断是否是24小时制
setCurrentHour(Integer currentHour) //设置当前的小时数
setCurrentMinute(Integer currentMinute) //设置当前的分钟
setEnabled(boolean enabled) //设置是否可用
setIs24HourView(Boolean is24HourView) //设置时间为24小时制


DatePicker(日期控件)
int getYear() //取得设置的年
int getMonth() //取得设置的月
int getDayOfMonth() //取得设置的日
setEnabled(boolean enabled) //设置是否可用
updateDate(int year, int monthOfYear, int dayOfMonth)//设置一个指定的日期


Spinner(下拉框)
public CharSequence getPrompt () //取得提示文字
public void setPrompt (CharSequence prompt)//设置组件的提示文字
public void setAdapter (SpinnerAdapter adapter)//设置下拉列表项


EditText属性(输入框)

android:selectAllOnFocus //在获取焦点时,会全选文本内容
android:focusable //true表示获取焦点 false表示不获取焦点
android:enabled //true表示可编辑,false表示不可编辑


RadioButton(单选按钮)
android:orietation="horizontal" //设置布局方式
android:checkedButton="单选按钮id" //设置默认选中的单选按钮
PS:单选按钮Radiobutton,一般需要嵌套在RadioGroup中达到单选的目的。
方法: getCheckedRadioButtonId();//获得选中的按钮的id

原文地址:https://www.cnblogs.com/shuchongzeishuai/p/6868777.html