自定义CheckBox或者RadioButton样式
来源:互联网 发布:淘宝量子统计没有了 编辑:程序博客网 时间:2024/05/21 00:21
在项目中经常会碰到需要自定义的CheckBox或者RadioButton,这里介绍一下:
1.首先定义一个图片选择器:
selector_setting_checkbox.xml
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/checkbox_setting_on" android:state_checked="true"/> <item android:drawable="@drawable/checkbox_setting" android:state_checked="false"/> <!-- <item android:drawable="@drawable/checkbox_normal"/> --></selector>
2. 在styles.xml中添加样式
<style name="setting_checkbox" parent="@android:style/Widget.CompoundButton.CheckBox"> <item name="android:button">@drawable/selector_setting_checkbox</item> </style>
3. 使用的时候给CheckBox或者RadioButton添加这个样式即可:
<RadioButton android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/clound_album_mode_public" style="@style/setting_checkbox" android:textColor="@color/common" android:textSize="18dip" />
- 自定义CheckBox或者RadioButton样式
- RadioButton和CheckBox自定义样式
- android自定义radiobutton、checkbox样式
- RadioButton和CheckBox自定义样式
- 自定义RadioButton&CheckBox样式的实现
- 自定义CheckBox和RadioButton的样式
- 自定义RadioButton&CheckBox样式的实现
- Android 常用控件自定义样式RadioButton、CheckBox、ProgressBar、
- RadioButton和CheckBox自定义按钮图片的样式
- 自定义RadioButton和Checkbox的按钮样式遇到的坑
- RadioButton - android 自定义RadioButton样式
- 自定义RadioButton样式1
- 自定义RadioButton样式
- RadioButton自定义样式
- android 自定义RadioButton样式
- 自定义RadioButton样式2
- 自定义RadioButton样式
- 自定义RadioButton样式2
- iOS Assembly Tutorial: Understanding ARM
- 浅谈无缓存I/O操作和标准I/O文件操作区别 (转载)
- 长沙 Goldbach
- AOP 那点事儿(续集)
- c#使用MethodInvoker解决跨线程访问控件
- 自定义CheckBox或者RadioButton样式
- 手工创建TR打包对象并导入到其他任意SAP系统
- 【iOS开发】iOS7 兼容及部分细节
- Flash中的动画制作方式?
- jsp页面动态生成验证码
- Windows下打包并在Tomcat7下运行Libreplan(基于Mysql)
- 我的Android进阶之旅------>Android拍照小例子
- FragmentTabHost用法
- 浅谈C++调用C#的DLL程序方法