Android自学笔记之RadioGroup和RadioButton的使用

1.单独一个RadioButton选择之后无法取消,而CheckBox可以取消,因此不建RadioButton单独使用

RadioGroup与RadioButton:

1 RadioGroup是RadioButton的一个集合,提供多选一机制。

2 属性:

android:orientation=""

vertical 垂直排布

horizontal 水平排布

决定当前RadioButton以什么方式排布!

<RadioGroup

<RadioButton

android:text="男";

/>

<RadioButton

android:text="女";

/>

/>

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-08-08 01:26:21

Android自学笔记之RadioGroup和RadioButton的使用的相关文章

Android自学笔记-16-任务栈

题目链接:http://acm.fzu.edu.cn/problem.php?pid=2170 贴个baka爷的代码留念.. 数据出的有问题,输入的字符串长度不超过1000 #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<map> #include<queue> #incl

Android自学笔记-17-广播接收者(BroadcastReceiver)

下载地址: http://pan.baidu.com/s/1pJ2lWYB Android自学笔记-17-广播接收者(BroadcastReceiver),码迷,mamicode.com

Android控件之RadioGroup与RadioButton(单选控件)

一.RadioGroup与RadioButton 1.什么是RadioGroup: RadioButton的一个集合,提供多选机制 2.什么是RadioButton: RadioButton包裹在RadioGroup中,RadioGroup表示一组RadioButton,下面可以有很多个RadioButton,但只能有一个被选中 3.RadioGroup属性: android:orientation——  设置RadioGroup中RadioButton以什么形式排列(有两个值分别是:horiz

Android 学习笔记---获取RadioGroup的选定值

1,获取RadioGroup控件: RadioGroup radioGroup = (RadioGroup)findViewById(R.id.myRadioGroup); 2,获取RadioButton控件; RadioButton radioButton = (RadioButton)findViewById(radioGroup.getCheckedRadioButtonId()); 3,获取选中的radio的值: String text = radioButton.getText().t

疯狂安卓Android自学笔记

开发者必备自学工具: 谷歌搜索:www.yundou.info Android原版开发文档 (英文) Doc http://www.phoned.cn/docs/reference/android/view/View.html Android原版开发文档 (英文) Doc 下载地址 http://www.phoned.cn/docs.zip 由于谷歌被封杀网页相关谷歌API无法调用打开会非常卡建议断网或FQ后使用. 2015-12-24 View 组件: 绝大多数的android基础控件都存在包

Android自学笔记:Git下载源代码

Info:做J2ME几年了,现在基本没有公司用了,是时候向Android领域进军了. 自学中,难免会有疏漏,有问题请及时提出,共同学习共同进步. 2014-10-13:初版 2014-10-14:添加 下载中断后的处理方法,可惜网上写的都没办法用,重新下载才行,谁有方法望告知. -------------------------------------------- 一.环境: 网址:https://android.googlesource.com/ (不能访问请FQ) 工具:Git(默认安装即

android 自学笔记2-布局

1.LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="horizontal" >  

android 自学笔记

今日学习了Android常用的控件 TextView     <TextView         android:id="@+id/text_view"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:gravity="center"         andro

Android自学笔记(四)简单电子宠物的实现

由于本人还是个菜鸡……代码质量难以保证,so仅供个人学习记录目的和仅供参考……要是发现什么bug会编辑博客……有意见建议欢迎提出! 最近在Android学习的过程中接触到了简单的动画效果,就突然想做个电子宠物应用一下(- ̄▽ ̄)-*. 素材来源是游戏逆转裁判的素材……也算表达一下个人对这一系列的爱……(- ̄▽ ̄)-*. gif的显示用的是GitHub的开源库:android-gif-drawable,https://github.com/koral--/android-gif-drawable