日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
Android單選框基本應(yīng)用方式講解

大家可能還記得,我們?cè)?jīng)為大家介紹過(guò)關(guān)于Android操作系統(tǒng)中復(fù)選框的一些應(yīng)用方式,那么今天大家將會(huì)了解到的則是關(guān)于Android單選框的一些基本概念,讓大家完全掌握這些選框的應(yīng)用,方便大家學(xué)習(xí)。#t#

●使用Android單選框的時(shí)候,要用RadioGroup來(lái)分組

●選擇RadioGroup里的單選框的時(shí)候,將調(diào)用RadioGroup的Check·()方法

●追加單選框被選擇時(shí)處理的時(shí)候,

1.調(diào)用setOnCheckedChangeListener()方法,并把RadioGroup.OnCheckedChangeListener實(shí)例作為參數(shù)傳入

2.在RadioGroup.OnCheckedChangeListener的onCheckedChanged()方法里,取得被選中Android單選框的實(shí)例

例程源碼(Java)

 
 
 
  1. view source print?01.RadioGroup radioGroup = (RadioGroup) 
    findViewById(id.radioGroup);   
  2. radioGroup.check(id.radioButtonGreen);  
  3. RadioButton radioButton = (RadioButton) findViewById(  
  4. radioGroup.getCheckedRadioButtonId());  
  5. Log.v("Test", String.valueOf(radioButton.getText()));  
  6. radioGroup.setOnCheckedChangeListener(  
  7. new RadioGroup.OnCheckedChangeListener() {  
  8. public void onCheckedChanged(  
  9. RadioGroup group,  
  10. int checkedId) {  
  11. RadioButton radioButton = (RadioButton) findViewById(checkedId);   
  12. Log.v("Test", String.valueOf(radioButton.getText()));  
  13. }  
  14. }); 

例程源碼(Resource)

 
 
 
  1. < RadioGroup android:id="@+id/radioGroup" 
  2. android:layout_width="wrap_content" 
  3. android:layout_height="wrap_content"> 
  4. < RadioButton android:id="@+id/radioButtonRed" 
  5. android:layout_width="wrap_content" 
  6. android:layout_height="wrap_content" 
  7. android:text="@string/Red" /> 
  8. < RadioButton android:id="@+id/radioButtonGreen" 
  9. android:layout_width="wrap_content" 
  10. android:layout_height="wrap_content" 
  11. android:text="@string/Green" /> 
  12. < RadioButton android:id="@+id/radioButtonBlue" 
  13. android:layout_width="wrap_content" 
  14. android:layout_height="wrap_content" 
  15. android:text="@string/Blue" /> 
  16. < /RadioGroup> 

Android單選框的基本應(yīng)用方式就為大家介紹到這里。


文章名稱:Android單選框基本應(yīng)用方式講解
網(wǎng)頁(yè)URL:http://www.5511xx.com/article/coihgch.html