RadioGroup中RadioButton图标文字居中解决
2016-05-17 16:22
239 查看
<RadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:layout_weight="1" //首先设置默认背景为空 android:button="@null" //设置顶部图片,这里为一个选择器 android:drawableTop="@drawable/main_home_select" android:text="首页" //设置文字颜色,这里为一个选择器 android:textColor="@drawable/main_rd_text" //设置居中 android:gravity="center" android:textSize="14sp" />
文字选择器
<selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_checked="true" android:color="@color/pink"></item> <item android:color="@color/gray"></item> </selector>
这里如果要用自定义颜色的话,需要在values文件夹下创建color.xml,然后这里调用
自定义颜色
在values下创建color.xml<resources> <color name="pink">#FF4040</color> <color name="gray">#5C5C5C</color> </resources>
相关文章推荐
- Bean
- 常用工具类——应用程序属性信息访问类
- as3实现图片轮播
- <<深入Java虚拟机>>-第三章-垃圾收集器与内存分配策略-学习笔记
- 多态
- 自定义ContentProvider
- 一个具有多值属性的实体怎么映射为关系
- 用GDB调试NGINX
- android 输入框EditText禁止输入Emoji表情符
- JAVA设计模式(03):创建型-单例模式(Singleton)
- HTTPProxy服务器
- C++ Builder 学习1
- eclipse
- 服务器IMM2实战介绍
- freescale imx6最新版本bsp在天嵌imx6q开发板的移值
- 类型判断总结
- 限制输入内容必须为数字 不能为0 开头
- properties文件的读取
- 第十二周项目3-数组类运算的实现
- ContentProvider之ContentResolver