首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

自定义RadioButton&CheckBox式样的实现

2012-08-30 
自定义RadioButton&CheckBox样式的实现http://hi.baidu.com/ljlkings/blog/item/a7945124de875c038a82a1b4

自定义RadioButton&CheckBox样式的实现
http://hi.baidu.com/ljlkings/blog/item/a7945124de875c038a82a1b4.html

Android 自定义RadioButton的样式

我们知道Android控件里的button,listview可以用xml的样式自定义成自己希望的漂亮样式。
  最近用到RadioButton,利用xml修改android:background="@drawable/button_drawable",其中button_drawable为自己定义的.xml文件(res/drawable文件下),但是不成功,到网上查找,也没有正确的说法,我就开始自己尝试,最后做好了。
  其实方法很简单,同样在res/drawable新建radiobutton.xml如下
  


  1 check和checknull分别为选中和位选中的图片。
  1 然后在你的布局文件中,RadioButton 布局
  1 设置android:button = "@drawable/radiobutton",就可以了!
  前后图片对比如下:




RadioButton修改样式



Android 自定义CheckBox 样式
http://www.pocketdigi.com/20110623/347.html
1,新建Android XML文件,类型选Drawable,根结点选selector,在这定义具体的样式。

2,应用到Checkbox与Button不同,并不是设置Background属性,而是设置style属性,所以我们要写一个style。
在style.xml写一个style,

3,应用到Checkbox:



新浪搜索界面 用到 自定义RadioButton
http://www.eoeandroid.com/thread-53703-1-1.html

风格化的 Toggle Buttons
http://blog.csdn.net/billpig/article/details/6634481

事实上,可以使用ToggleButton来模仿CheckBox:
 

热点排行