<?xml version="1.0" encoding="UTF-8"?>

    <LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">

    <TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="多选控件:" android:id="@+id/label"/>
<RadioGroup android:orientation="horizontal" android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/radionGroup">
<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="女" android:id="@+id/radioFemale"/>
<RadioButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="男" android:id="@+id/radioMale" android:checked="true"/>
<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="确定" android:id="@+id/ok"/>
</RadioGroup> </LinearLayout>
package com.example.yanlei.mytk;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton; public class MainActivity extends AppCompatActivity { private RadioButton radioFemale;
private RadioButton radioMale;
private Button ok; @Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); radioFemale=(RadioButton)findViewById(R.id.radioFemale);
radioMale=(RadioButton)findViewById(R.id.radioMale);
ok=(Button)findViewById(R.id.ok); ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String result = "你选择的是:";
if (radioFemale.isChecked()) {
setTitle(result + "女");
} else {
setTitle(result + "男");
}
}
});
}
}

andriod RadioButton的更多相关文章

  1. Andriod 自定义控件之创建可以复用的组合控件

    前面已学习了一种自定义控件的实现,是Andriod 自定义控件之音频条,还没学习的同学可以学习下,学习了的同学也要去温习下,一定要自己完全的掌握了,再继续学习,贪多嚼不烂可不是好的学习方法,我们争取学 ...

  2. RadioButton与CheckBox

    笔者长期从事于数据库的开发,算了,不提当年了,因为一直用的是小语种(PowerBuilder),还是来说说这两个最常见的控件吧! RadioButton(单选)和CheckBox(多选) 先来看看继承 ...

  3. 【WPF】值是枚举的RadioButton 绑定问题

    源 1.RadioButton 2.IValueConverter 3.枚举 xaml实现 <RadioButton Content="单打热身" GroupName=&qu ...

  4. Android RadioGroup和RadioButton详解

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

  5. react native RadioButton(单选按钮)

    刚刚写完这个多选按钮,我觉得没有单选的话,总会觉得有一点点不爽,因为在项目中我也没有用到单选,所以我没有好好研究源码,所以我在Github上找了一下,发现有一个挺好的,简单,不花哨. 在Github上 ...

  6. RadioButton(单选按钮)文字在按钮的左边

    <RadioButton style="@style/CustomCheckboxTheme" android:layout_width="fill_parent& ...

  7. Web Api 与 Andriod 接口对接开发经验

    最近一直急着在负责弄Asp.Net Web Api 与 Andriod 接口开发的对接工作! 刚听说要用Asp.Net Web Api去跟 Andriod 那端做接口对接工作,自己也是第一次接触Web ...

  8. RadioGroup、RadioButton、CheckBox、Toast用法

    xml布局文件如下: <RadioGroup android:id="@+id/sex" android:layout_width="wrap_content&qu ...

  9. 背水一战 Windows 10 (33) - 控件(选择类): ListBox, RadioButton, CheckBox, ToggleSwitch

    [源码下载] 背水一战 Windows 10 (33) - 控件(选择类): ListBox, RadioButton, CheckBox, ToggleSwitch 作者:webabcd 介绍背水一 ...

随机推荐

  1. MFC ADO连接Oracle12c数据库 类库文件

    Stdafx.h Stdafx.h libado.h libado.h libado.cpp libado.cpp 参考网址如下:http://www.cnblogs.com/livewithnore ...

  2. linux 多台 主机的免登录ssh的配置

    1.首先检查 有没有安装ssh rpm-qa | grep ssh 如果没有安装 yum install ssh 2.在每一台机器上执行  ssh-keygen -t rsa  会在root/.ssh ...

  3. 你不知道的javascript

    一.对象 JavaScript简单类型有数字.字符串.布尔值.null.undefined,其他所有的值都是对象(数组.函数.正则表达式都是对象). 数字.字符串.布尔值虽然拥有方法(包装对象),但并 ...

  4. Breach - HTML5 时代,基于 JS 编写的浏览器

    Breach 是一款属于 HTML5 时代的开源浏览器项目,,完全用 Javascript 编写的.免费.模块化.易于扩展.这个浏览器中的一切都是模块,Web 应用程序在其自己的进程运行.通过选择合适 ...

  5. So Easy!让开发人员更轻松的工具和资源

    这篇文章给大家分享让开发人员生活更轻松的免费工具和资源.所以,如果你正在寻找一些为迅速解决每天碰到的设计和开发问题的工具和资源,不要再观望,试试这些工具吧.这些奇妙的工具不仅会加快您的生产,也让你的工 ...

  6. iOS-图片轮播-SDCycleSCrollView的使用

    介绍: SDCycleScrollView 是一款非常强大的轮播图第三方. 轮播流畅,手滑流畅.使用方便.自定义简单. 可以更改pageControl. 一. Demo地址 https://pan.b ...

  7. Web Service常识

      1 问题的引出 位于服务器的程序需要在Web页面上显示一个订单列表,它需要访问业务对象服务器上的程序,通过它读取订单列表,业务对象服务器又要访问数据库服务器.当一台计算机上的程序调用另一台计算机上 ...

  8. 转载:第三弹!全球首个微信小程序(应用号)开发教程!通宵吐血赶稿,每日更新!

    感谢朋友们的支持!这两天博卡君收到了很多支持和安慰,也认识了很多志同道合的朋友.目前微信公布的工具和代码都不是正式版,随时有可能调整,大家先体验和学习为主吧.最近这个教程搞得我也心力交瘁了,虽然苦逼, ...

  9. 高级四则运算器—结对项目总结(193 &105)

    高级四则运算器—结对项目总结 为了将感想与项目经验体会分割一下,特在此新开一篇博文. 界面设计 啥都不说,先上图震慑一下... 上面的三个界面是我们本次结对项目的主界面,恩,我也觉得挺漂亮的!你问我界 ...

  10. IntelliTrace简介

    解决无法复现bug所使用的策略是在遇到bug时捕获尽可能多的信息,在使用IntelliTrace进行调试时可以充分利用这些信息.最令人称道的一个功能在于bug本身可以自动修复. 打开IntelliTr ...