安卓学习之--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地址. 原版只支持下拉刷新,强化之后支持上拉刷新和一进入页面就加载刷新,整个控件的加载动画是一致的,毫无违和感 ...
随机推荐
- JavaScript中的面向对象
//简单的面向对象 function 构造函数(){ this.属性; } //写在构造函数里面的属性一般为公共属性,或者通过传值进行改变. 构造函数.原型.方法 = function(){}; // ...
- ASP.NET获取客户端IP地址
public static string GetRealIP() { string ip; try { ...
- Cocoapods - pod install 成功后找不到头文件解决
问题描述:使用Cocoapods时,import 找不到头文件. 问题原因:这是因为还没设置头文件的目录. 解决办法:在项目的Target的里设置一下,添加cocoapods头文件目录:目录路径直接写 ...
- JQuery UI dialog 弹窗实例及参数说明
按钮代码: <a id="suprise" style="margin-left: 0.5em;cursor:pointer;">点我会有惊喜< ...
- *****linux下redis安装
我用的系统是:redhat [root@infa ~]# wget http://download.redis.io/releases/redis-2.8.12.tar.gz tar xzf redi ...
- 名词含义阅读 todolist
1.node webkit 2.C#设计模式 3.算法导论 4.SQLSERVER RowNum() 5.图片文字识别 6.tuple 7.yield 8.Web语义化 (多用 p ul ol li ...
- net-force.nl/programming writeup
从 wechall.net 到 net-force.nl 网站,发现网站的内容不错,里面也有不同类型的挑战题目:Javascript / Java Applets / Cryptography / E ...
- Myeclipse下的struts2.3.8 配置 保证绝对好用
转自:http://blog.csdn.net/oxuannishi/article/details/8538386 1.建立web project工程,我的结构如下: 2.这一步非常重要:引入必要的 ...
- mysql 列类型
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
java日期格式大全 format SimpleDateFormat(转) SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH ...