RadioButton 自定义控件
在res/drawable新建radiobutton.xml(本案例为video——evaluate.xml)如下
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="true"
android:state_checked="true"
android:drawable="@drawable/comment_highlight" />
<item
android:state_enabled="true"
android:state_checked="false"
android:drawable="@drawable/comment_normail" /> <item
android:state_enabled="true"
android:state_checked="false"
android:drawable="@drawable/comment_normail" />
<item
android:state_enabled="true"
android:state_checked="false"
android:drawable="@drawable/comment_normail" /> <item
android:state_enabled="true"
android:state_checked="false"
android:drawable="@drawable/comment_normail" /> </selector>
布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f3f3f3"
android:orientation="vertical" > <include layout="@layout/titlebar" /> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="15dp"
android:paddingLeft="10dp"
android:text="对此次服务满意吗?"
android:textColor="#2e2e2e"
android:textSize="@dimen/text_size18sp" /> <View
android:layout_width="fill_parent"
android:layout_height="0.8dp"
android:layout_marginTop="10dp"
android:background="@color/expertlist_divider_color" /> <RadioGroup
android:id="@+id/evaluate_rg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/white"
android:paddingBottom="8dp"
android:paddingTop="8dp" > <RadioButton
android:id="@+id/radio1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:paddingBottom="10dp"
android:checked="true"
android:text="非常满意"
android:textSize="18sp"
android:button="@drawable/video_evaluate" /> <View
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:layout_marginTop="10dp"
android:background="@color/expertlist_divider_color" /> <RadioButton
android:id="@+id/radio2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="满意"
android:textSize="18sp"
android:button="@drawable/video_evaluate" /> <View
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:layout_marginTop="10dp"
android:background="@color/expertlist_divider_color" /> <RadioButton
android:id="@+id/radio3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="一般"
android:textSize="18sp"
android:button="@drawable/video_evaluate" /> <View
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:layout_marginTop="10dp"
android:background="@color/expertlist_divider_color" /> <RadioButton
android:id="@+id/radio4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="不满意"
android:textSize="18sp"
android:button="@drawable/video_evaluate" /> <View
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:layout_marginTop="10dp"
android:background="@color/expertlist_divider_color" /> <RadioButton
android:id="@+id/radio5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="非常不满意"
android:textSize="18sp"
android:button="@drawable/video_evaluate" /> <View
android:layout_width="fill_parent"
android:layout_height="0.3dp"
android:layout_marginTop="10dp"
android:background="@color/expertlist_divider_color" />
</RadioGroup> <Button
android:id="@+id/bt_evaluate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/expert_yuye_bg_selector"
android:text="提交"
android:textColor="@color/white"
android:textSize="@dimen/text_size16sp" /> </LinearLayout>
效果,自己可以优化一下再:

RadioButton 自定义控件的更多相关文章
- WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式
一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要内容: Che ...
- 【转】WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式
一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等 本文主要内容: CheckBox复选框的自定义样式,有两种不同的风格实现: RadioB ...
- [WPF 自定义控件]在MenuItem上使用RadioButton
1. 需求 上图这种包含多选(CheckBox)和单选(RadioButton)的菜单十分常见,可是在WPF中只提供了多选的MenuItem.顺便一提,要使MenuItem可以多选,只需要将MenuI ...
- 【Android自定义控件】支持多层嵌套RadioButton的RadioGroup
前言 非常喜欢用RadioButton+RadioGroup做Tabs,能自动处理选中等效果,但是自带的RadioGroup不支持嵌套RadioButton(从源码可看出仅仅是判断子控件是不是Radi ...
- WPF自定义控件与样式(3)-TextBox & RichTextBox & PasswordBox样式、水印、Label标签、功能扩展
一.前言.预览 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要是对文本 ...
- Android笔记——Android自定义控件
目录: 1.自定义控件概述 01_什么是自定义控件 Android系统中,继承Android系统自带的View或者ViewGroup控件或者系统自带的控件,并在这基础上增加或者重新组合成我们想要的效果 ...
- WPF自定义控件与样式(1)-矢量字体图标(iconfont)
一.图标字体 图标字体在网页开发上运用非常广泛,具体可以网络搜索了解,网页上的运用有很多例子,如Bootstrap.但在C/S程序中使用还不多,字体图标其实就是把矢量图形打包到字体文件里,就像使用一般 ...
- WPF自定义控件与样式(2)-自定义按钮FButton
一.前言.效果图 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 还是先看看效果 ...
- 老猪带你玩转android自定义控件一——打造最简单viewpagerindicator
viewpagerindicator,既使用viewpager翻页时候,标题的指示条随着改变的控件,是常用android控件之一,几乎所有的新闻类APP中都有使用.如下图所示: 今天,我们将从0到1实 ...
随机推荐
- javascript 设计模式之观察者模式
观察者模式又叫发布——订阅模式,顾名思义pub——sub就是被动触发的,:不要给我......,我会给你.......就是一个发布订阅的解释,实质就是对程序中的某个对象状态进行监听观察,并且在该对象发 ...
- npm命令总结
统一切换到项目目录 安装redux :npm install -save redux 安装react-redux : npm install -save react-redux
- seajs中spm压缩工具使用
seajs是个好东西,用起来很方便,但是她的压缩工具spm确不被网友看好,因为使用起来很麻烦,捯饬了一天多,终于勉强能压缩了,这里就简单记录一下. 按照地址:http://www.zhangxinxu ...
- WPF中多个RadioButton绑定到一个属性
如图样: 在View中: <RadioButton IsChecked="{Binding Option, Converter={cvt:EnumToBooleanConverter} ...
- java正则表达式小练习(IP地址检测、排序,叠词的处理,邮件地址的获取)
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; import java.util.reg ...
- 如何准备阿里社招面试,顺谈 Java 程序员学习中各阶段的建议
引言 其实本来真的没打算写这篇文章,主要是LZ得记忆力不是很好,不像一些记忆力强的人,面试完以后,几乎能把自己和面试官的对话都给记下来.LZ自己当初面试完以后,除了记住一些聊过的知识点以外,具体的内容 ...
- 值得拥有!精心推荐几款超实用的 CSS 开发工具
当你开发一个网站或 Web 应用程序的时候,有合适的工具,绝对可以帮助您节省大量的时间.在这篇文章中,我为大家收集了超有用的 CSS 开发工具. 对于 Web 开发人员来说,找到有用的 CSS 开发工 ...
- [git]安装git-pylint-commit-hook提高python项目中的代码质量
什么是'git-pylint-commit-hook' 我在工作中,团队为了保证代码和提高代码的质量,要求每个项目都要求安装git-pylint-commit-hook,它是个钩子,会在你提交代码到本 ...
- Android 学习笔记之AndBase框架学习(三) 使用封装好的函数完成Http请求..
PS:踏踏实实走好每一步... 学习内容: 1.使用AndBase框架实现无参Http Get请求... 2.使用AndBase框架实现有参Http Post请求... 3.使用AndBase框架实现 ...
- 微软IIS对http keep-alive的“霸道”处理
大家都知道在IIS中有个HTTP keep-alive设置,见下图: 很多人可能和我们一样,以为这样设置后,IIS会就在发送响应内容时加上这个http header——Connection: keep ...