先上效果图

message_toolbar_left_bg_selector

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="10.0dp" android:bottomRightRadius="0.0dp" android:topLeftRadius="10.0dp" android:topRightRadius="0.0dp" />
<solid android:color="@color/orange" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="10.0dp" android:bottomRightRadius="0.0dp" android:topLeftRadius="10.0dp" android:topRightRadius="0.0dp" />
<solid android:color="@color/orange" />
</shape>
</item>
<item android:state_checked="true">
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="10.0dp" android:bottomRightRadius="0.0dp" android:topLeftRadius="10.0dp" android:topRightRadius="0.0dp" />
<solid android:color="@color/orange" />
</shape>
</item>
<item>
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="10.0dp" android:bottomRightRadius="0.0dp" android:topLeftRadius="10.0dp" android:topRightRadius="0.0dp" /> <solid android:color="@color/white"/></shape>
</item>
</selector>

  

message_toolbar_right_bg_selector

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="0.0dp" android:bottomRightRadius="10.0dp" android:topLeftRadius="0.0dp" android:topRightRadius="10.0dp" />
<solid android:color="@color/orange" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="0.0dp" android:bottomRightRadius="10.0dp" android:topLeftRadius="0.0dp" android:topRightRadius="10.0dp" />
<solid android:color="@color/orange" />
</shape>
</item>
<item android:state_checked="true">
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="0.0dp" android:bottomRightRadius="10.0dp" android:topLeftRadius="0.0dp" android:topRightRadius="10.0dp" />
<solid android:color="@color/orange" />
</shape>
</item>
<item>
<shape>
<size android:width="69.0dp" android:height="27dp" />
<!-- 线的宽度,颜色灰色 -->
<stroke android:width="0.5dp" android:color="@color/orange"></stroke>
<!-- 矩形的圆角半径 -->
<corners android:bottomLeftRadius="0.0dp" android:bottomRightRadius="10.0dp" android:topLeftRadius="0.0dp" android:topRightRadius="10.0dp" /> <solid android:color="@color/white" />
</shape>
</item>
</selector>

  布局界面

 <RadioGroup
android:id="@id/rg_group"
android:layout_width="138.0dp"
android:layout_height="27.0dp"
android:layout_centerInParent="true"
android:orientation="horizontal"> <RadioButton
android:id="@id/rbtn_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:checked="true"
android:gravity="center"
android:background="@drawable/message_toolbar_left_bg_selector"
android:text="标题1"
android:textColor="@color/message_toolbar_font_color" /> <RadioButton
android:id="@id/rbtn_chat_room"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:gravity="center"
android:background="@drawable/message_toolbar_right_bg_selector"
android:text="标题2"
android:textColor="@color/message_toolbar_font_color" />
</RadioGroup>

  

android selector shape 使用的更多相关文章

  1. android selector 开始自定义样式

    Selector的结构描述: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:a ...

  2. android selector(转)

    Selector的结构描述: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:a ...

  3. Android UI设计系统-android selector 开始自定义样式

    Selector的结构描述: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:a ...

  4. Android 使用shape定义不同控件的的颜色、背景色、边框色

    Android 使用shape定义不同控件的的颜色.背景色.边框色 设置按钮的右边框和底边框颜色为红色,边框大小为3dp: 在drawable新建一个 buttonstyle.xml的文件,内容如下: ...

  5. Android学好Shape不再依赖美工

    原创 2014年03月27日 15:33:41 标签: Android Shape用法 20427 先上图 其实以上效果没有让美工提供任何图片 只要学会Shape你就能实现 想怎么样就怎么样 下面介绍 ...

  6. 【转】【Android】Android Drawable Shape 组合画田字格

    使用layer-list组合多个Shap <?xml version="1.0" encoding="utf-8"?> <layer-list ...

  7. selector + shape

    selector_shape.xml<?xml version="1.0" encoding="utf-8"?> <selector xmln ...

  8. android中shape 的使用

    android 开发中 对于 shape 和 selector的使用,一直都不是很熟练, 记录一下.便于以后参考. 举个项目中例子图 对于上面的2个radiobutton ,背景我们可以让美工做一个. ...

  9. Drawable实战解析:Android XML shape 标签使用详解(apk瘦身,减少内存好帮手)

    Android XML shape 标签使用详解   一个android开发者肯定懂得使用 xml 定义一个 Drawable,比如定义一个 rect 或者 circle 作为一个 View 的背景. ...

随机推荐

  1. django中的CBV

    CBV介绍 我们在写一个django项目时,通常使用的都是FBV(function base views) 而CBV(class base views)也有它自己的应用场景,比如在写一个按照rest规 ...

  2. Python—内置函数

    内置函数 内置函数补充  all: 所有iterable类型,包含的元素要全为真才返回真 >>> all([0,-1,5]) False >>> all([-1,5 ...

  3. 64位win7连接ACCESS报错“Microsoft.Jet.OLEDB.4.0”问题

    本人开发了桌面软件,关于事务提醒,自己一直在用,很喜欢,但是在64位win7上无法运行,网上说多种方法,都觉得麻烦.后来自己在vs2012下编译成x86版本,结果可以运行在64位win7下了. 原来如 ...

  4. java输入最大10位数,倒数输出(很鸡肋)

    public class D { public static void main(String[] args) { System.out.println("请输入数字(最大十位数):&quo ...

  5. [Leetcode 771]宝石和石子 Jewels and Stones HashSet简单应用

    [题目] You're given strings J representing the types of stones that are jewels, and S representing the ...

  6. Binary Tree Path Sum

    Given a binary tree, find all paths that sum of the nodes in the path equals to a given number targe ...

  7. 第一章03 java 开发环境搭建

    1. 首先,搭配java开发环境,安装(jdk:java 开发工具包) 2.安装下载:输入www.oracle.com.cn/indek.html  (cn代表中文) 3.测试安装是否成功 (1)wi ...

  8. 周强 201771010141《面向对象程序设计(java)》第四周学习总结

    实验目的与要求 (1) 理解用户自定义类的定义: (2) 掌握对象的声明: (3) 学会使用构造函数初始化对象: (4) 使用类属性与方法的使用掌握使用: (5) 掌握package和import语句 ...

  9. Canvas名侦探柯南-canvas练习

    var canvas=document.getElementById("canvas"); var ctx=canvas.getContext("2d"); / ...

  10. echarts双y轴折线图柱状图混合实时更新图

    先看下效果,自己用ps做了张gif图,发现很好玩啊..不喜勿喷 自己下载个echarts.min.js 直接上代码: <!DOCTYPE html><html><head ...