安卓学习之--UI控件用法 单选 按钮 下拉框
1。单选
.RadioGroup 可将各自不同的RadioButton ,设限于同一个Radio 按钮组,同一个RadioGroup 组里的按钮,只能做出单一选择(单选题).
<RadioGroup android:id="@+id/group"
android:orientation="horizontal">
<RadioButton android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="没过5年"
android:checked="true"
android:id="@+id/rdyear5"
/>
<RadioButton android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="过5年"
android:id="@+id/rdyearno5"
/>
</RadioGroup>
.java
private RadioGroup group;
private RadioButton rb1 ;
private RadioButton rb2 ;
private boolean blflag; group=(RadioGroup) this.findViewById(R.id.group);
rb1=(RadioButton) this.findViewById(R.id.rdyear5);
rb2=(RadioButton) this.findViewById(R.id.rdyearno5);
group.setOnCheckedChangeListener(new checkedlistener()); public class checkedlistener implements RadioGroup.OnCheckedChangeListener{ @Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(checkedId==R.id.rdyear5){
blflag=true;
}else if(checkedId==R.id.rdyearno5){
blflag=false;
}
} }
按钮 Button是各种UI中最常用的控件之一,它同样也是Android开发中最受欢迎的控件之一,用户可以通过触摸它来触发一系列事件,要知道一个没有点击事件的Button是没有任何意义的,因为使用者的固定思维是见到它就想去点!
<Button
android:id="@+id/btncal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="计算" />
.java
Button btncal=(Button) this.findViewById(R.id.btncal); //获取该按钮控件
btncal.setOnClickListener(new listener()); //事件 private class listener implements View.OnClickListener{ @Override
public void onClick(View v) { } }
安卓学习之--UI控件用法 单选 按钮 下拉框的更多相关文章
- 自定义SWT控件四之其它下拉框
4.其它下拉框 4.1 添加联动二级多选择框(有添加按钮和删除按钮) package com.view.control.select; import java.util.ArrayList; impo ...
- GridControl控件绑定RepositoryItemImageComboBox 作为下拉框使用
如果,时间长时了,已前做过的东西,都记不得了,所以记录一下. 废话不多说. 1.拖出gridview控件,然后将字段绑定上去 2.将要做下拉框的控件加入RepositoryItemImageCombo ...
- devpress GridControl控件绑定RepositoryItemImageComboBox 作为下拉框使用 zt
1.拖出gridview控件,然后将字段绑定上去 2.将要做下拉框的控件加入RepositoryItemImageComboBox控件 3.绑定数据 ; i < ; i++) { //如果取值时 ...
- Android简易实战教程--第二十二话《自定义组合控件模拟qq登录下拉框和其中的一些”小技巧”》
转载此文章请注明出处:点击打开链接 http://blog.csdn.net/qq_32059827/article/details/52313516 首先,很荣幸此专栏能被CSDN推荐到主页.荣 ...
- Selenium常用API用法示例集----下拉框、文本域及富文本框、弹窗、JS、frame、文件上传和下载
元素识别方法.一组元素定位.鼠标操作.多窗口处理.下拉框.文本域及富文本框.弹窗.JS.frame.文件上传和下载 元素识别方法: driver.find_element_by_id() driver ...
- 关于Devexpress15.2中GridControl控件选择字段ColumnEdit下拉时间设置
效果:点击表格GridControl控件中的列,可以显示日期和时间.时间可以手动修改.(绑定日期格式的字段) 设置步骤:1.点击时间字段列表设置ColumnEdit-New-选择DateEdit出现r ...
- 模拟select控件,css模拟下拉
<!DOCTYPE html > <head> <meta http-equiv="Content-Type" content="t ...
- 使用谷歌提供的SwipeRefreshLayout下拉控件,并自定义实现下拉加载的功能
package com.loaderman.swiperefreshdemo; import android.os.Bundle; import android.os.Handler; import ...
- 第一个开源控件:Google 官方下拉刷新控件 SwipeRefreshLayout 强化版,支持上拉刷新
最近比较闲,所以趁着这时间撸了个SwipeRefreshLayout的加强版,Github地址. 原版只支持下拉刷新,强化之后支持上拉刷新和一进入页面就加载刷新,整个控件的加载动画是一致的,毫无违和感 ...
随机推荐
- html常用标签介绍
常用标签介绍 文本 最常用的标签可能是<font>了,它用于改变字体,字号,文字颜色. 点击查看效果 <font size="6">6</font&g ...
- [Git] 还原Git上commit,但是没有push代码
直接在Idea上操作2步解决: 1. 找到: 2. 在To Commit里面填写:HEAD^,表示将commit的信息还原为上一次的,需要多次直接reset多次即可: 使用命令行:原理一样 以下内容转 ...
- 传参数应该用哪种形式——值、引用、指针?
类型:C++ & Qt4,创建时间:十二月 30, 2011, 7:43 p.m. 标题无"转载"即原创文章,版权所有.转载请注明来源:http://hgoldfish.c ...
- 主机ping不同虚拟机
前提:今天加班时,一不小时把网线踢掉了,然而虚拟机怎么都ping不通了,试过很多办法; 最后.... 简单粗暴的重启了我的主机,对,是主机,不是虚拟机,ok,问题解决; over...
- js控制刷新后回到页面原来位置
1.document.location.reload(); 2.http://www.jb51.net/article/99749.htm
- JAVABeanUtils
在写如何使用java BeanUlits 之前需要清楚几件事情 1. 我们每次所定义的类,其实是实体,同时也被称作为JavaBean; 2. 为什么我们要使用BeanUlits这个框架 &g ...
- Effective C++ 笔记2(构造,析构,赋值)
条款5:了解C++默默编写并且调用了哪些函数 1. 构造函数,析构函数,拷贝赋值函数,拷贝构造函数. class Empty { public: //默认构造函数 Empty(){}; //拷贝构造 ...
- docker 1.8+之后ubuntu安装指定版本docker-engine
这边记录ubuntu安装过程,首先是官网文档 If you haven’t already done so, log into your Ubuntu instance. Open a termina ...
- HDU4417 Super Mario(主席树)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4417 Description Mario is world-famous plumber. ...
- CODEVS 天梯 代码记录
所有水题均被折叠 Lv.1 青铜 1201 #include<iostream> #include<cstring> #include<algorithm> #in ...