RadioButton的特定使用场景
2016-02-26 17:48
190 查看
1 使用场景:
结合radioGroup实现类似微信底部导航的效果
2 使用问题:
我是用纯代码动态添加radioButton , 根据需求 需要去掉button
在高版本上显示没有问题,在低版本上(如<=16)就会出现下面情况
3 解决办法:
就算纯代码添加radiobutton ,radiobutton的对象的创建也要从xml中引用(期待大神的别的解决方案)
android:button="@null"
android:background="@null" 这两个是关键点
结合radioGroup实现类似微信底部导航的效果
我是用纯代码动态添加radioButton , 根据需求 需要去掉button
RadioButton button; for (int i = 0; i < titleNames.length; i++) { button = new RadioButton(context); // 隐藏左侧 button button.setButtonDrawable(new ColorDrawable(Color.TRANSPARENT)); ........ addView(button, params); }
在高版本上显示没有问题,在低版本上(如<=16)就会出现下面情况
3 解决办法:
就算纯代码添加radiobutton ,radiobutton的对象的创建也要从xml中引用(期待大神的别的解决方案)
RadioButton button; for (int i = 0; i < titleNames.length; i++) { // 从xml 引用 button = (RadioButton) View.inflate(getContext(), R.layout.but,null); addView(button, params); }
<?xml version="1.0" encoding="utf-8"?> <RadioButton xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:button="@null" android:background="@null" > </RadioButton>
android:button="@null"
android:background="@null" 这两个是关键点
相关文章推荐
- CentOS 救援模式 (rescue installed system)修复损坏系统
- Java常用算法总结
- alsa声卡驱动分析总结 (三)
- 音乐播放器
- lamp lnmp lnamp区别
- [Linux]./configure 编译调试信息
- Linux中Apache安装、配置、加为服务
- 如何学好图像处理——从小白到大神?
- xml增强学习笔记
- 使用jquey的css()方法改变样式,
- How to make workflow chart using several tools in Linux?
- SQL语句详细汇总
- 年度十佳 DevOps 博客文章(后篇)
- ioS开发知识(三十一)
- 做飞行器的规划及想法
- Yii2 framework学习笔记(八) -- 整合blueimp的jquery-file-upload插件
- Git学习笔记总结和注意事项
- Android Process 详解
- chrome dev 4000 tools
- springmvc讲解