CheckBox和Button之间选择的联动效果
来源:互联网 发布:化学分子模型淘宝 编辑:程序博客网 时间:2024/06/08 07:13
写一个简单的小Demo.,如下图:
首先:布局文件就是checkBox–TextView–TextView–Button,就不贴了
checkBox的点击选择如下:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:drawable="@drawable/icon_checked"/> <item android:state_checked="false" android:drawable="@drawable/icon_unchecked"/></selector>
button的背景选择如下:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true" android:drawable="@drawable/btn_common_pressed"/> <item android:state_enabled="false" android:drawable="@drawable/btn_common_disable"/></selector>
最后:主题代码如下
final Button btn = (Button) findViewById(R.id.next_btn); CheckBox checkBox = (CheckBox) findViewById(R.id.agree_protocal); //设置checkBox的选择监听 checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked) { btn.setEnabled(true); }else { btn.setEnabled(false); } } });
以上,就ok
阅读全文
0 0
- CheckBox和Button之间选择的联动效果
- checkbox,联动菜单的效果
- jquery 多个checkbox的联动选择
- 使用jqery和PHP实现选择框的联动效果
- CTreeCtrl 联动选择 checkbox
- 和Button一样的CheckBox
- 下拉框之间的联动效果
- 自定义CheckBox,用自己的方式来实现个性勾选。checkbox与button的联动。
- 带checkbox的treeview父子节点的联动选择
- GridView里的 checkbox 和button
- button实现一组checkbox的全选与全不选效果
- checkbox的选择和赋值
- easyui datagrid 列标题中设置checkbox后,解除与行选择的checkbox联动方法
- 具有三级联动效果的地区选择 angulagerJS
- lightbox+checkbox实现轻量级联动选择
- [ATL/WTL]_[中级]_[原生的复选框(checkbox button)和单选按钮(radio button)实现透明背景效果解决方案]
- DropDownList 和ListBox产生的联动效果
- TabLayout和ViewPager的联动效果实现
- JAVA 对象序列化小例子实现
- what the GMV?
- Android中自定义圆形图片(一)
- 【算法题】合唱团
- HBuilder的热更新
- CheckBox和Button之间选择的联动效果
- LAMP服务搭建详解
- 八爪鱼
- bootstrap-validator 验证一个标签同时验证另一个指定标签
- nodejs第一站
- salesforce自定义按钮使用js与后台交互demo/自定义按钮跳转至指定URL
- mysql升级
- Lua> io.write(“\27[2J”)
- 学生信息管理系统源代码和视频文件,视频教程!