RadioGroup
     RadioButton的集合,提供多选一的机制
     属性:
  android:orientation="horizontal/vertical"
          vertical     垂直排布
          horizontal     水平排布          决定当前RadioGroup中RadioButton以什么形式排列
 
private RadioGroup rg ;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
               rg=(RadioGroup) findViewById(R.id. radioGroup1);
               //实现RadioGroup的监听事件
               rg.setOnCheckedChangeListener( new OnCheckedChangeListener() {
                      @Override
                      public void onCheckedChanged(RadioGroup group, int checkedId) {
                            // TODO Auto-generated method stub
                            switch (checkedId) {
                            case R.id.radio :
                                  System. out.println();
                                   break;
                            case R.id.radio0 :
                                  System. out.println();
                                   break;
                            case R.id.radio1 :
                                  System. out.println();
                                   break;
                            default:
                                   break;
                            }
                     }
              });
       }
 
 
 <RadioGroup
        android:id="@+id/radioGroup1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
         >
 
        <RadioButton
            android:id="@+id/radio0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="true"
            android:text="0" />
 
        <RadioButton
            android:id="@+id/radio1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1" />
    </RadioGroup >

Android RadioGroup/RadioButton的更多相关文章

  1. [Android]--RadioGroup+RadioButton实现底部导航栏

    RadioGroup+RadioButton组合方式打造简单实用的底部导航栏 代码块: <?xml version="1.0" encoding="utf-8&qu ...

  2. Android RadioGroup和RadioButton详解

    实现RadioButton由两部分组成,也就是RadioButton和RadioGroup配合使用.RadioGroup是单选组合框,可以容纳多个RadioButton的容器.在没有RadioGrou ...

  3. android单选按钮选择,RadioGroup,radioButton

    android单选按钮选择,RadioGroup,radioButton 14. 四 / android基础 / 没有评论   单选布局绑定 如何识别选择

  4. Android RadioGroup的RadioButton 选择改变字体颜色和背景颜色

    RadioGroup <RadioGroup android:id="@+id/client_charge_radiogroup" android:layout_width= ...

  5. android.widget.RadioButton 单选按钮(转)

    大家好,我们今天这一节要介绍的是RadioGroup 的组事件.RadioGroup 可将各自不同的RadioButton ,设限于同一个Radio 按钮组,同一个RadioGroup 组里的按钮,只 ...

  6. Android 自定义RadioButton实现

    由于使用小米系统MIUI运行是RadioButton样式跟google Android API自定义的不一样,则我们可以定义任何想要的东东.没有做不到,只有想不到 Android 自定义RadioBu ...

  7. Android之RadioButton多行

    RadioGroup设置orientation="vertical"竖向单列显示 RadioGroup设置orientation="horizontal"横向单 ...

  8. Android——RadioGroup和CheckBox

    xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= ...

  9. Android 单选按钮(RadioButton)和复选框(CheckBox)的使用

    1.RadioButton (1)介绍 (2)单选按钮点击事件的用法 (3)RadioButton与RadioGroup配合使用实现单选题功能 (4)xml布局及使用 <?xml version ...

随机推荐

  1. 【最大流】【HDU3338】【Kakuro Extension】

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3338 题目大意:填数字,使白色区域的值得和等于有值得黑色区域的相对应的值,用网络流来做 题目思路:增加 ...

  2. Hadoop安装(2)安装hadoop 前的centos 设置

    将虚拟机网络连接设为:Bridged 添加用户:hadoop,设置密码.关闭防火墙,selinux.暂且不关闭不需要的任务. 参照:http://www.cnblogs.com/xia520pi/ar ...

  3. android的color整理(一)

    很全面的颜色收集方便以后使用. <!-- 白色 --> <color name="ivory">#fffff0</color> <!-- ...

  4. 去掉UItableview headerview黏性

    //去掉UItableview headerview黏性 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView ...

  5. discuz二次开发笔记(一)------$_G全解析

    $_G 保存了 Discuz! 中所有的预处理数据缓存能够很好的提高程序的性能,一些配置数据没必要每次都查询数据库,只要在修改了的时候更新下缓存即可.Discuz! 中所有的缓存保存在 $_G[cac ...

  6. DRBD脑裂解决方法

    1.查看主服务器 [root@master ~]# /etc/init.d/drbd status drbd driver loaded OK; device status: version: (ap ...

  7. Android 截取本地图库图片 并显示

    package com.example.image; import android.app.Activity; import android.content.Intent; import androi ...

  8. xml 解析 Xstream

    1.概述 json 解析可以使用gson包解为现成的对象,那么xml可以不可以用现成的包解析成java的对象呢? 带着这个问题,查询了一些材料找到了Xstream解析方法,确实可以完成这种思考,只是实 ...

  9. jQuery学习-事件之绑定事件(三)

    在上一篇<jQuery学习-事件之绑定事件(二)>我们了解了jQuery的dispatch方法,今天我们来学习下handlers 方法: handlers: function( event ...

  10. Mac OS X:Dock 的附加功能

    Dock 提供了可能并非显而易见的有用控件和菜单.通过修饰键的不同组合(如 Option 键.Control 键)及鼠标点按的不同类型(点按与按下及按住),即可使用下列附加功能.本文适用于 Mac O ...