android去掉 radio 或 checkBox 的默认图标,用自己的图标
来源:互联网 发布:淘宝网2017女装羽绒服 编辑:程序博客网 时间:2024/05/07 14:10
1.第一步(checkbox和RadioButton一样)
android:button="@null"2.第二步(同上,两个一样)
android:background="@drawable/textselector"3.注意
a.在模拟器上跑每个radiobutton需要设置id,否则多个radiobutton可以多选
b.真机上不用设置id,不会出现上面的情况
布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" tools:context=".MainActivity"> <RadioGroup android:id="@+id/rg_one" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <RadioButton android:id="@+id/rb_one" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <RadioButton android:id="@+id/rb_two" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <RadioButton android:id="@+id/rb_three" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <RadioButton android:id="@+id/rb_four" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RadioGroup> <RadioGroup android:id="@+id/rg_two" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/rg_one" android:layout_marginTop="20dp" android:orientation="horizontal"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/textselector" android:button="@null" /> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/textselector" android:button="@null" /> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/textselector" /> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/textselector" /> </RadioGroup> <CheckBox android:id="@+id/cb_one" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/rg_two" android:layout_marginTop="20dp" /> <CheckBox android:id="@+id/cb_two" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/cb_one" android:layout_marginTop="20dp" android:background="@drawable/textselector" android:button="@null" /></RelativeLayout>
效果图:(模拟器上)
点击下载源码
0 0
- android去掉 radio 或 checkBox 的默认图标,用自己的图标
- 去掉select右边的默认图标
- 去掉或自定义ExpandableListView的箭头图标
- Android studio的默认图标
- 定制个性化的 Android Checkbox 图标
- 定制个性化的 Android Checkbox 图标
- 定制个性化的 Android Checkbox 图标
- 自定义android checkbox的图标和文字
- 定制个性化的 Android Checkbox 图标
- Android—去掉expandablelistview左边的图标
- Android—去掉ExpandableListView的箭头图标
- Android中如何通过代码的形式隐藏掉Checkbox的默认图标.
- JFrame重绘去掉默认的标题图标等
- android修改默认的返回图标
- Android Studio中默认图标的引用
- 自己的网页图标
- 使用自己的图标
- 去掉窗体上的图标
- angular controller 依赖声明
- QTableView基本用法讲解,Qt表格控件的使用方法
- 设定三原色的值, 生成对应的屏幕背景
- Python迭代器和生成器
- Android学习第四天之AbsoluteLayout绝对布局
- android去掉 radio 或 checkBox 的默认图标,用自己的图标
- 链式栈
- 汉语字典
- quartz_jobs.xml配置文件样例2--CronTrigger
- 九度OJ 1030:毕业bg (01背包、DP)
- C#中的 int? int??是什么意思
- iOS8以后第三方键盘,获取高度为0的问题
- 67Add Binary
- Mvc Html.BeginForm 方式提交Form前验证