setOnCheckedChangeListener监听check事件

clearCheck选择状态消除

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

>

android:id="@+id/myTextView"

android:layout_width="228px"

android:layout_height="49px"

android:text="@string/str_radio_question1"

android:textSize="30sp"

android:layout_x="37px"

android:layout_y="3px"

/>

android:id="@+id/myRadioGroup"

android:layout_width="137px"

android:layout_height="216px"

android:orientation="vertical"

android:layout_x="3px"

android:layout_y="54px"

>

android:id="@+id/myRadioButton1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/tr_radio_op1"

/>

android:id="@+id/myRadioButton2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/tr_radio_op2"

/>

android:onClick="bt"

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Button" />

package com.example.radiogroup;

import android.os.Bundle;

import android.support.v7.app.ActionBarActivity;

import android.view.View;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget.RadioGroup.OnCheckedChangeListener;

import android.widget.TextView;

public class MainActivity extends ActionBarActivity {

public TextView mTextView1;

public RadioGroup mRadioGroup1;

public RadioButton mRadio1,mRadio2;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

mTextView1 = (TextView) findViewById(R.id.myTextView);

mRadioGroup1 = (RadioGroup) findViewById(R.id.myRadioGroup);

mRadio1 = (RadioButton) findViewById(R.id.myRadioButton1);

mRadio2 = (RadioButton) findViewById(R.id.myRadioButton2);

mRadioGroup1.setOnCheckedChangeListener(new OnCheckedChangeListener() {

@Override

public void onCheckedChanged(RadioGroup group, int checkedId) {

// TODO Auto-generated method stub

if(mRadio1.getId() == checkedId){

mTextView1.setText("nan");

}else{

mTextView1.setText("nv");

}

}

});

}

public void bt(View view){

//将选择状态消除掉

mRadioGroup1.clearCheck();

}

}

android radiogroup 点击事件,RadioGroup组与onCheckedChanged事件相关推荐

  1. android 点击事件两次,Android 按钮点击两次触发不同的事件

    标题:Android 按钮点击两次触发不同的事件 方案:采用flag标记的方式,每次单击标记为0,再次点击判断flag的值 package com.ldl.ui; import android.app ...

  2. 用事件标志组实现多事件的单向同步

    文章目录 1 用事件标志组实现多事件的单向同步 1 用事件标志组实现多事件的单向同步 问题需求: 某一任务等待事件中一个或多个事件同时发生. 解决方案: 事件发生时,设置指定事件标志位,任务4等待所有 ...

  3. 【Android每日一讲】2012.11.27 向左或向右 - RadioGroup组与onCheckedChanged事件

    1. 范例说明 今天介绍RadioGroup的组事件.RadioGroup可将各自不同的RadioButton设限于同一个Radio按钮组,同属于一个RadioGroup组里的按钮,只能做出单一选择( ...

  4. RTX5 | 事件标志组02 - 置位事件标志组,并获取事件标志组的值

    文章目录 一.前言 二.实验目的 三.API 3.1.osEventFlagsSet 3.2.osEventFlagsGet 四.代码 4.1.main.h 4.2.main.c 五.Event Re ...

  5. RTX5 | 事件标志组01 - 创建事件标志组

    文章目录 一.前言 二.实验目的 三.API 3.1.osEventFlagsAttr_t 3.2.osEventFlagsNew 四.代码 4.1.main.h 4.2.main.c 五.Event ...

  6. 事件标志组的等待与通知

    文章目录 1 事件标志组的等待与通知 1.1 设计需求 1.2 设计实现 1 事件标志组的等待与通知 1.1 设计需求 当事件标志位发生时: 没有任务等待,设置相应的事件标志. 有任务等待时,唤醒等待 ...

  7. 事件标志组的原理与创建

    文章目录 1 事件标志组的原理与创建 1.1 问题概述 1.2 设计原理 1.3 设计实现 1 事件标志组的原理与创建 1.1 问题概述 如何在中断ISR与任务之间传递多个事件标志? 可以通过事件标志 ...

  8. FreeRTOS源码分析与应用开发07:事件标志组

    目录 1. 概述 2. 事件标志组类型 3. 创建事件标志组 4. 删除事件标志组 5. 设置事件标志位 5.1 任务级设置 5.2 中断级设置 6. 清除事件标志位 6.1 任务级清除 6.2 中断 ...

  9. RTOS原理与实现09:事件标志组实现

    目录 1. 事件标志组的原理与创建 1.1 问题概述 1.2 设计原理 1.3 设计实现 1.3.1 定义事件标志组类型 1.3.2 添加tFlagGroupInit函数 2. 事件标志组的等待与通知 ...

最新文章

  1. 2019年2月26日 Unique Email Addresses、To Lower Case、Encode and Decode TinyURL
  2. hdu 3853 LOOPS 概率DP
  3. java 2d 绘图教程_Java标准教程:Java 2D绘图--第2章 从绘图开始
  4. 杂项:SVN 常用方法
  5. java设计模式之备忘_[译]Java 设计模式之备忘录
  6. @WebFilter()配置servlet访问出现404的原因
  7. 关于wsgi协议的理解
  8. Python爬虫从入门到放弃(二十一)之 Scrapy分布式部署
  9. 尚硅谷视频分享_硅谷的女儿分享了她的“书呆子”故事
  10. 版本控制工具 Git 和SVN 的区别
  11. sql左连接查询,去重复数据
  12. 计算机文档排版的心得体会,排版工作心得体会(共6篇) .docx
  13. u盘变o字节怎么修复_U盘变成0字节了数据怎么恢复
  14. this关键字的四种用法
  15. AB91-1 HESG437479R1 HESG437899
  16. MacOS 更新系统或XCode终端Git报错
  17. 直接使用word模板生成word文件
  18. 十一酸睾酮(TU)行业调研报告 - 市场现状分析与发展前景预测
  19. zabbix php微信报警,Zabbix实现微信报警
  20. SSH Tunnel隧道

热门文章

  1. Unity Cache Server Disabled
  2. /etc/sysconfig/iptables详解
  3. 微信/QQ中打开链接提示浏览器中打开遮罩
  4. Android 应用有哪些自动化测试工具
  5. jbpm工作流(jBPM工作流组件设计分析)
  6. Educoder/头歌JAVA——JavaWeb:JSP入门
  7. Docker 镜像概念及操作
  8. 被隐藏的过程——预处理
  9. Irvine32.inc
  10. 通过一张模糊的照片,判断拍摄的具体位置