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实 ...
随机推荐
- 怎样在EPLAN P8里创建自己想要的电气元件符号
1.打开Eplan P8 ,新建一个名为"新项目"的项目,然后选择菜单"工具"----"主数据"-----"符号库"-- ...
- android EditText inputType说明
在开发的过程中,通常会用到EditText,如何让虚拟键盘来适应输入框中内容的类型,通常我们都会在xml文件中加入android:inputType="". android:inp ...
- 十四、EnterpriseFrameWork框架核心类库之简易ORM
在写本章前先去网上找了一下关于ORM的相关资料,以为本章做准备,发现很多东西今天才了解,所以在这里也对ORM做不了太深入的分析,但还是浅谈一下EFW框架中的设计的简易ORM:文中有一点讲得很有道理,D ...
- 代码演示用 KnockoutJS 和 Web API 对一个表格(Gird)进行 CRUD 操作,在 MVC 5 下
实体类: using System; using System.Collections.Generic; public partial class EmployeeInfo { public int ...
- codeforces George and Job
/* 题意:给一个长度为n的序列, 从中选择长度为m的k个区间(任意两个区间不会有公共部分) 使得所选择的区间的和最大! 思路:这是一种很常见的dp dp[i][j] 表示的是前 i 个数选择 j 个 ...
- MongoDB的学习--文档的查询
继续关于<MongoDB权威指南>记录,今天的内容是文档的查询~~ MongoDB官网地址:http://www.mongodb.org/ 我使用的是MongoDB 2.4.8 find函 ...
- 《构建之法》之第8、9、10章读后感 ,以及sprint总结
第8章: 主要介绍了软件需求的类型.利益相关者,获取用户需求分析的常用方法与步骤.竞争性需求分析的框架NABCD,四象限方法以及项目计划和估计的技术. 1.软件需求:人们为了解决现实社会和生活中的各种 ...
- Entity FrameWork 增删查改
Add #region 1.0 新增+void Add() /// <summary> /// 新增 /// </summary> static void Add() { // ...
- C#写文本日志帮助类(支持多线程)
代码: using System; using System.Configuration; using System.IO; using System.Threading.Tasks; namespa ...
- 运用Microsoft.DirectX.DirectSound和Microsoft.DirectX实现简单的录音功能
1.首先要使用Microsoft.DirectX.DirectSound和Microsoft.DirectX这两个dll进行录音,需要先安装microsoft directx 9.0cz这个组件, 百 ...