標籤:
一、RadioButton及RadioGroup的用法【重點】
RadioButton、RadioGroup的常用屬性
// 獲得選中的RadioButton的id
int checkedRadioButtonId = gender.getCheckedRadioButtonId();
綁定RadioGroup特有監聽器
// 監聽單選項改變
gender.setOnCheckedChangeListener(new OnCheckedChangeListener() {
// group表示當前的RadioGroup
// checkedId表示選中的RadioButton的id
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton checkedBtn = (RadioButton) findViewById(checkedId);
// 第一個參數表示上下文
// 第二個參數表示要顯示的文本
// 第三個參數表示顯示的時間
Toast.makeText(MainActivity.this, checkedBtn.getText().toString(), Toast.LENGTH_SHORT).show();
}
});
二、CheckBox的多選效果及監聽
CheckBox的常用屬性
綁定CheckBox特有監聽器
setOnClickListener();
三、ProgressBar
ProgressBar的基本用法
a.ProgressBar的常用屬性
android:max="" 設定進度條最大長度
android:progress="" 設定進度條當前進度
android:secondaryProgress="" 設定secondaryProgress當前進度
style="" 設定進度條風格
標題列的ProgressBar(瞭解即可)
b.ProgressBar的常用方法
getProgress();/setProgress();
setMax();
getSecondaryProgress();/setSecondaryProgress();
c.ProgressBar美化
android:progressDrawable="@drawable/my_progressbar_style"設定水平進度條的顏色
android:indeterminateDrawable設定圓形進度條的圖片
http://blog.csdn.net/u012702547/article/details/50669932
四、SeekBar
SeekBar的基本用法
a.繼承關係及使用情境
b.常用屬性
android:max=""
android:progress=""
android:secondaryProgress=""
c.常用方法
setMax();
setOnSeekBarChangeListener();
setProgress();
d.SeekBar的美化
style="@android:style/Widget.SeekBar"
android:maxHeight="2dp"
android:minHeight="2dp"
android:progressDrawable="@drawable/myseekbarprogressdrawable"
android:thumb="@drawable/myselctor"
【幻化萬千戲紅塵】qianfeng-Android-Day03-RadioButton及RadioGroup的用法、CheckBox、ProgressBar基礎學習: