在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" /><TextViewandroid: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" /><Viewandroid:layout_width="fill_parent"android:layout_height="0.8dp"android:layout_marginTop="10dp"android:background="@color/expertlist_divider_color" /><RadioGroupandroid: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" > <RadioButtonandroid: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" /><Viewandroid:layout_width="fill_parent"android:layout_height="0.3dp"android:layout_marginTop="10dp"android:background="@color/expertlist_divider_color" /><RadioButtonandroid: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" /><Viewandroid:layout_width="fill_parent"android:layout_height="0.3dp"android:layout_marginTop="10dp"android:background="@color/expertlist_divider_color" /><RadioButtonandroid: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" /><Viewandroid:layout_width="fill_parent"android:layout_height="0.3dp"android:layout_marginTop="10dp"android:background="@color/expertlist_divider_color" /><RadioButtonandroid: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" /><Viewandroid:layout_width="fill_parent"android:layout_height="0.3dp"android:layout_marginTop="10dp"android:background="@color/expertlist_divider_color" /><RadioButtonandroid: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" /><Viewandroid:layout_width="fill_parent"android:layout_height="0.3dp"android:layout_marginTop="10dp"android:background="@color/expertlist_divider_color" /></RadioGroup><Buttonandroid: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>

效果,自己可以优化一下再:

转载于:https://www.cnblogs.com/McCa/p/4522792.html

RadioButton 自定义控件相关推荐

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

    原文:WPF自定义控件与样式(4)-CheckBox/RadioButton自定义样式 一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等, ...

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

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

  3. Android自定义控件系列之基础篇

    一.概述 在android开发中很多UI控件往往需要进行定制以满足应用的需要或达到更加的效果,接下来就通过一个系列来介绍自定义控件,这里更多是通过一些案例逐步去学习,本系列有一些典型的应用,掌握好了大 ...

  4. 自定义控件:Viewpager

    自定义控件:Viewpager package com.itheima.myviewpager66;import android.content.Context; import android.uti ...

  5. 介绍几个好用的android自定义控件

    首先看效果图, 看下这两个界面,第一个中用到了一个自定义的FlowRadioGroup,支持复合子控件,自定义布局: 第二个界面中看到了输入的数字 自动4位分割了吧:也用到了自定义的DivisionE ...

  6. WPF自定义控件与样式(8)-ComboBox与自定义多选控件MultComboBox

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

  7. 【自定义控件】自定义属性

    做 Android布局是件很享受的事,这得益于他良好的xml方式.使用xml可以快速 有效的为软件定义界面.可是有时候我们总感觉官方定义的一些基本组件不够用,自定义组件就不可避免了.那么如何才能做到像 ...

  8. 让 WPF 的 RadioButton 支持再次点击取消选中的功能

    让 WPF 的 RadioButton 支持再次点击取消选中的功能 目录 让 WPF 的 RadioButton 支持再次点击取消选中的功能 零.前言 一.方法一:后台直接处理 二.方法二:提取为自定 ...

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

    一.前言.预览 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要是对文本输入控件进行样式开发,及相关扩展功能开发,主要内容包括: 基本文 ...

最新文章

  1. .NET 2.0防止同用户同时登陆实例
  2. LibSVM学习(一)——初识LibSVM
  3. Javaweb-AJAX快速入门及案例实战
  4. layui的css文件自己写的吗_安装教程和自己的使用tips
  5. matlab光学毕业论文,光学信息处理实验的Matlab仿真.doc
  6. [转]Ubuntu远程桌面登陆
  7. 团队任务3 每日立会
  8. c语言程序怎么打分数,用C语言编程平均分数
  9. Confluence 6 导入 Active Directory 服务器证书 - Windows
  10. MongoDB与Tokyo Tyrant性能比较(2):并发写入操作
  11. 《python程序员面试宝典(陈屹)》chapter1 技术面试方法论
  12. 【搬运】 Cadence orcad常用库olb介绍
  13. 概率分布分位点_概率统计计量经济学_假设检验中的重要概念_分位点/p值
  14. C语言中的字符常量与变量
  15. 上周热点回顾(2.16-2.22)
  16. 用ue4怎么制作一个物体故障闪烁的特效
  17. [Element Migrating][ElInput][Attribute]: icon is removed, use suffix-icon / prefix-icon instead.
  18. Ubuntu 安装QQ for Linux 笔记
  19. Dockerfile 搭建Redis 高可用
  20. 2017最新研究成果SIGIR

热门文章

  1. CSS 外补白(Margin) 内补白(Padding) 边框属性 定位(positioning)属性 布局(layout)属性
  2. 处理问题:变量名‘@UserName’已声明。变量名在插叙批次或存储过程内部必须唯一
  3. Android中Gallery和ImageSwitcher的使用
  4. Map-Reduce的过程解析
  5. android 的listview 3大优化策略
  6. golang单向散列函数
  7. 正则匹配所有包括换行符
  8. 《java多线程编程实战指南 核心篇》读书笔记一
  9. 数据结构:选择排序(Selection sort)
  10. csdn将文章添加到专栏