开发学院手机开发Android 开发 Android单选和多选择按钮 阅读

Android单选和多选择按钮

 2010-10-12 02:13:00 来源:本站整理   
核心提示:}else if(maleButton.getId() == checkedId){System.out.println("male");}}});//为多选按钮添加监听器swimBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedC

}

else if(maleButton.getId() == checkedId)

{

System.out.println("male");

}

}

});

//为多选按钮添加监听器

swimBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

// TODO Auto-generated method stub

if(isChecked)

{

System.out.println("swim is checked");

}

else

{

System.out.println("swim is unchecked");

}

}

});

runBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

// TODO Auto-generated method stub

if(isChecked)

{

System.out.println("run is checked");

}

else

{

System.out.println("run is unchecked");

}

}

});

readBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

@Override

public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

// TODO Auto-generated method stub

if(isChecked)

{

System.out.println("read is checked");

}

else

{

System.out.println("read is unchecked");

}

}

});

}

}

相关配置文件:radio.xml

Js代码

1. < ?xml version="1.0" encoding="utf-8"?>

2. < LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

3. android:orientation="vertical"

4. android:layout_width="fill_parent"

5. android:layout_height="fill_parent"

上一页  1 2 3 4 5  下一页

Tags:Android 单选 选择

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接