【幻化萬千戲紅塵】qianfeng-Android-Day03-RadioButton及RadioGroup的用法、CheckBox、ProgressBar基礎學習:

來源:互聯網
上載者:User

標籤:

一、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基礎學習:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.