android 自定义 radiobutton 文字颜色随选中状态而改变

主要是写一个 color selector
在res/建一个文件夹取名color
res/color/color_radiobutton.xml
- <?xml version="1.0" encoding="utf-8"?>
- <selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_checked="true" android:color="@color/color_text_selected"/>
- <!-- not selected -->
- <item android:color="@color/color_text_normal"/>
- </selector>
程序中就可以直接使用了
- //layout/main.xml
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <RadioGroup
- android:id="@+id/radiogroup_personal_condition"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
- <RadioButton
- android:id="@+id/radiobutton_1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/selector_radio"
- android:button="@null"
- android:checked="true"
- android:gravity="center"
- android:text="目录"
- android:textColor="@color/color_radiobutton"
- android:textSize="@dimen/font_size"
- android:textStyle="bold" />
- <RadioButton
- android:id="@+id/radiobutton_2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="@drawable/selector_radio"
- android:button="@null"
- android:gravity="center"
- android:text="书签"
- android:textColor="@color/color_radiobutton"
- android:textSize="@dimen/font_size"
- android:textStyle="bold" />
- </RadioGroup>
- </LinearLayout>
android 自定义 radiobutton 文字颜色随选中状态而改变的更多相关文章
- android自定义radiobutton样式文字颜色随选中状态而改变
主要是写一个 color selector 在res/建一个文件夹取名color res/color/color_radiobutton.xml <selector xmlns:android= ...
- Android自定义radiobutton(文字靠左,选框靠右)
<RadioButton android:id="@+id/rb_never" android:layout_width="fill_parent" an ...
- Android 自定义RadioButton实现
由于使用小米系统MIUI运行是RadioButton样式跟google Android API自定义的不一样,则我们可以定义任何想要的东东.没有做不到,只有想不到 Android 自定义RadioBu ...
- Android 自定义RadioButton的样式
Android 自定义RadioButton的样式 我们知道Android控件里的button,listview可以用xml的样式自定义成自己希望的漂亮样式. 最近用到RadioButton,利用xm ...
- android 自定义进度条颜色
android 自定义进度条颜色 先看图 基于产品经理各种自定义需求,经过查阅了解,下面是自己对Android自定义进度条的学习过程! 这个没法了只能看源码了,还好下载了源码, sources\b ...
- 带你体验Android自定义圆形刻度罗盘 仪表盘 实现指针动态改变
带你体验Android自定义圆形刻度罗盘 仪表盘 实现指针动态改变 转 https://blog.csdn.net/qq_30993595/article/details/78915115 近期有 ...
- 转:android 自定义RadioButton样式
http://gundumw100.iteye.com/blog/1146527 上面这种3选1的效果如何做呢?用代码写? 其实有更简单的办法,忘了RadioButton有什么特性了吗? 我就用Ra ...
- Android 自定义RadioButton样式
上面这种3选1的效果如何做呢?用代码写? 其实有更简单的办法,忘了RadioButton有什么特性了吗? 我就用RadioButton实现了如上效果,其实很简单的. 首先定义一张background ...
- Android Textview实现文字颜色渐变效果
最近做应用的时候遇到一个需求,一行文字的颜色需要一个渐变效果 如上所有 从左到有逐渐变化,自己写了一个demo实现上述效果 package com.huwei.example.test; import ...
随机推荐
- 动态执行linq 语句 NLinq
using Evaluant.NLinq.Memory;using System.Collections.Generic;using Evaluant.NLinq;using System.Colle ...
- ndk文件操作问题及小结
最近在做文件传输,发现在android下用f系列的C库函数去读取文件文件大小会受到2G大小的约束,查阅了很久,最后只能去看google的libc源码,发现了以下几个问题: 1.bionic的libc是 ...
- PHP图像操作:3D图、缩放、旋转、裁剪、添加水印(三)
来源:http://www.ido321.com/887.html 5.PHP对图像的旋转 1: <div> 2: <h4>旋转之前</h4> 3: <img ...
- Tkinter教程之Canvas篇(3)
本文转载自:http://blog.csdn.net/jcodeer/article/details/1811922 ''Tkinter教程之Canvas篇(3)''''''16.移动item'''# ...
- Jquery类级别与对象级别插件开发
jQuery插件的开发包括两种: 一种是类级别的插件开发,即给jQuery添加新的全局函数,相当于给jQuery类本身添加方法.jQuery的全局函数就是属于jQuery命名空间的函数,另一种是对象级 ...
- Hibernate之HQL查询
一.Hibernate 提供了以下几种检索对象的方式: 导航对象图检索方式: 根据已经加载的对象导航到其他对象 OID 检索方式: 按照对象的 OID 来检索对象 HQL 检索方式:使用面向对象的 H ...
- PC问题-VMware Workstation出现“文件锁定失败”
问题现象:电脑关机时挂起VMware Workstation后,第二天运行VMware Workstation出现“文件锁定失败”. 问题原因:在WIN的目录中有*.LCK文件,此文件是用来锁定当前虚 ...
- hdu 5363 Key Set
http://acm.hdu.edu.cn/showproblem.php?pid=5363 Key Set Time Limit: 2000/1000 MS (Java/Others) Mem ...
- HTTP协议状态码详解
HTTP状态码,我都是现查现用. 我以前记得几个常用的状态码,比如200,302,304,404, 503. 一般来说我也只需要了解这些常用的状态码就可以了. 如果是做AJAX,REST,网络爬虫, ...
- HDU 2795 Billboard (线段树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795 题目大意:有一块h*w的矩形广告板,要往上面贴广告; 然后给n个1*wi的广告,要求把广告贴 ...