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实 ...
随机推荐
- HDU 3487 Play with Chain(Splay)
题目大意 给一个数列,初始时为 1, 2, 3, ..., n,现在有两种共 m 个操作 操作1. CUT a b c 表示把数列中第 a 个到第 b 个从原数列中删除得到一个新数列,并将它添加到新数 ...
- osgi: HttpService A null service reference is not allowed.
最近在学习osgi,在练习HttpService的过程中,一直出现“A null service reference is not allowed”这样的报错,代码本身没有问题,在网上也搜了不少地方, ...
- JDBC连接SQL Server2008
在使用JDBC连接数据库之前首先要加载相应数据库的JDBC驱动类,可以通过通用方法Class.forName来加载驱动类. 方式一:使用JDBC-ODBC连接桥 一般安装JDK后会自带JDBC-O ...
- 导出excel和PDF小结 vba
最近接触了一个关于Access工具的项目,所以整理下需要使用的方法. 功能要求简介: 1.将数据表中的数据导出到excel和PDF 2.并根据某个字段名称分sheet输出. 3.无模板方式 方案简介: ...
- Bower 手册
安装 Bower 使用 npm 安装 Bower.(Bower 依赖于 Node, npm 和 Git.) $ npm install -g bower 基本用法 安装程序包 程序包安装命令 bowe ...
- 模拟MessageBox
原文:<模拟MessageBox> Posted on 2014/01/07 ======================================================= ...
- 前端们,gulp该用起来了,简单的demo入门——gulp系列(一)
gulp.grunt前端自动化工具,只有用过才知道多么重要. 它们问世这么久了?你真的用过吗? 写个简单的less.watch任务的demo分享———— 1.准备: 安装全局node.npm,这个教程 ...
- Testing - Selenium
Selenium http://www.seleniumhq.org/ User Guide http://www.seleniumhq.org/docs/ Webdriver中文社区 http:// ...
- 创意欣赏:20幅字体排版(Typography)素描
通常我们都只关注最终的作品,但其实幕后还有很多的过程,其中一个是素描.素描用来表达最初思想观念的原型.有时客户需要一个独特的品牌新LOGO或字体,这时先绘制在纸上是比较方便的,之后扫描到 Photos ...
- onhashchange事件,只需要修改hash值即可响应onhashchange事件中的函数(适用于上一题下一题和跳转页面等功能)
使用实例: 使用onhashchange事件做一个简单的上一页下一页功能,并且当刷新页面时停留在当前页 html: <!DOCTYPE html><html><body& ...