在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 自定义控件的更多相关文章

  1. WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要内容: Che ...

  2. 【转】WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式

    一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等 本文主要内容: CheckBox复选框的自定义样式,有两种不同的风格实现: RadioB ...

  3. [WPF 自定义控件]在MenuItem上使用RadioButton

    1. 需求 上图这种包含多选(CheckBox)和单选(RadioButton)的菜单十分常见,可是在WPF中只提供了多选的MenuItem.顺便一提,要使MenuItem可以多选,只需要将MenuI ...

  4. 【Android自定义控件】支持多层嵌套RadioButton的RadioGroup

    前言 非常喜欢用RadioButton+RadioGroup做Tabs,能自动处理选中等效果,但是自带的RadioGroup不支持嵌套RadioButton(从源码可看出仅仅是判断子控件是不是Radi ...

  5. WPF自定义控件与样式(3)-TextBox & RichTextBox & PasswordBox样式、水印、Label标签、功能扩展

    一.前言.预览 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要是对文本 ...

  6. Android笔记——Android自定义控件

    目录: 1.自定义控件概述 01_什么是自定义控件 Android系统中,继承Android系统自带的View或者ViewGroup控件或者系统自带的控件,并在这基础上增加或者重新组合成我们想要的效果 ...

  7. WPF自定义控件与样式(1)-矢量字体图标(iconfont)

    一.图标字体 图标字体在网页开发上运用非常广泛,具体可以网络搜索了解,网页上的运用有很多例子,如Bootstrap.但在C/S程序中使用还不多,字体图标其实就是把矢量图形打包到字体文件里,就像使用一般 ...

  8. WPF自定义控件与样式(2)-自定义按钮FButton

    一.前言.效果图 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 还是先看看效果 ...

  9. 老猪带你玩转android自定义控件一——打造最简单viewpagerindicator

    viewpagerindicator,既使用viewpager翻页时候,标题的指示条随着改变的控件,是常用android控件之一,几乎所有的新闻类APP中都有使用.如下图所示: 今天,我们将从0到1实 ...

随机推荐

  1. const ,static,inline

    const: 1 定义变量 ,如下写法都可以: TYPE const ValueName = value;                  const TYPE ValueName = value; ...

  2. 让IE8支持HTML5及canvas功能!

    微软出的IE9支持HTML5,但因为不支持XP系统,暂时我还用不了. 即使能用,现阶段如果开发HTML5页面,并考虑到兼容性问题的话,恐怕也得让自己的界面支持IE6-8吧. 首先,需要让IE支持HTM ...

  3. MFC中混合使用Duilib制作界面

    因为公司项目最近入了MFC的这个大坑,用MFC做UI做了一段时间,感觉不是很方便,开发效率有点慢. 看了c++里面做界面的类库,感觉Duilib比较符合做界面的需求,而且很多大公司也在使用Duilib ...

  4. CAS认证原理图

  5. Python & Django 学习笔记

    最近在学校Python和Django.在学习中遇到了种种的问题,对于一个新手来说,下面的问题可能都会遇到.希望能帮助到那些和我一样的人!!0.python-dev安装(ubuntu)  apt-get ...

  6. Linux查看系统信息命令汇总

    # uname -a # 查看内核/操作系统/CPU信息 # /etc/issue # 查看操作系统版本 # cat /proc/cpuinfo # 查看CPU信息 # hostname # 查看计算 ...

  7. STL中priority_queue小结

    (1)为了运用priority_queue,你必须包含头文件<queue>:#include<queue> (2)在头文件中priority_queue定义如下: namesp ...

  8. 【Head-First设计模式】C#版-学习笔记-开篇及文章目录

    原文地址:[Head-First设计模式]C#版-学习笔记-开篇及文章目录 最近一年断断续续的在看技术书,但是回想看的内容,就忘了书上讲的是什么东西了,为了记住那些看过的东西,最好的办法就是敲代码验证 ...

  9. PowerMock 简介--转载

    原文地址:https://www.ibm.com/developerworks/cn/java/j-lo-powermock/ EasyMock 以及 Mockito 都因为可以极大地简化单元测试的书 ...

  10. 探索jdk8之ConcurrentHashMap 的实现机制

    在介绍ConcurrentHashMap源码之前,很有必要复习下java并发编程中的一些基础知识,比如内存模型等. 存储模型 并发编程中的三个概念 1.原子性 2.可见性 3.重排序 对HashMap ...