Selector的2种样式

【!-- Selector的样式1--】【注:选中前、轩中式、选中后;下面:一种是图片、一种是扁平化风格】

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_enabled="true" android:state_pressed="false">

  <shape>

    <solid android:color="#FFFFFF" />

    <corners android:radius="1dp" />

    <stroke android:width="1dp" android:color="#9e9e9e" />

  </shape>

</item>

<item android:state_enabled="true" android:state_pressed="true">

  <shape>

              <solid android:color="#E0E0E0" />

              <corners android:radius="1dp" />

       <stroke android:width="1dp" android:color="#9e9e9e" />

  </shape>

</item>

<item android:state_enabled="false">

  <shape>

    <solid android:color="#E0E0E0" />

    <corners android:radius="1dp" />

    <stroke android:width="1dp" android:color="#9e9e9e" />

   </shape>

</item>

</selector>

【!-- Selector的样式2--】

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

  <item android:drawable="@drawable/chatting_setmode_voice_btn_focused" android:state_focused="true"></item>                                  <item android:drawable="@drawable/chatting_setmode_voice_btn_pressed" android:state_focused="false" android:state_pressed="true"></item>

    <item android:drawable="@drawable/chatting_setmode_voice_btn_normal"></item>

</selector>

【属性解释】 【gradient:渐变】 android:startColor:起始颜色;android:endColor结束颜色,android:angle:渐变角度,必须为45的整数倍。

另外渐变默认的模式为android:type="linear",即线性渐变,可以指定渐变为径向渐变,android:type="radial",径向渐变需要指定半径android:gradientRadius="50"。

【stroke:描边】 android:width:描边的宽度,android:color: 描边的颜色。 描边可以做成虚线的式,设置方式为:android:dashWidth:一个横线的宽度;android:dashGap:之间隔开的距离.

【corners:圆角】 android:radius:角的弧度,值越大角越圆。

【padding:内间距】

【solid为背景填充色】

时间: 2024-08-03 23:20:57

Selector的2种样式的相关文章

转载:CSS的组成,三种样式(内联式,嵌入式,外部式),优先级

(仅供自己备份) 原文地址:http://blog.csdn.net/chq11106004389/article/details/50515717 CSS的组成 选择符/选择器+声明(属性+值) 选择符/选择器,指明网页中要应用样式规则的元素,如本例中是p是选择器,它的文字将变成蓝色,而其他的元素(如ol)不会受到影响 声明:当有多条声明时,中间可以英文分号";"分隔 --------------------------------------------------内联式CSS -

html5的三种样式

虽然最近一直在加班,但是对html5的学习还是不敢落下,html5的样式这节课听得比较仔细,我自己觉得也比较重要,样式也是html5中一个比较重要的点. 表示样式的标签有两个style和link,style用于样式的定义,link用于资源的引用,把一些外部的样式引用到html页面中.样式中的属性主要有rel.type.margin,用法如:rel="stylesheet"表示外部样式表,type="text/css"表示引入css文档,margin-left表示左边

artdialog对话框 三种样式 网址:http://www.planeart.cn/demo/artDialog/_doc/labs.html

摇头效果 类似与wordpress登录失败后登录框可爱的左右晃动效果 // 2011-07-17 更新 artDialog.fn.shake = function (){ var style = this.DOM.wrap[0].style, p = [4, 8, 4, 0, -4, -8, -4, 0], fx = function () { style.marginLeft = p.shift() + 'px'; if (p.length <= 0) { style.marginLeft =

CSS的三种样式:内联式,嵌入式,外部式以及他们的优先级

从CSS 样式代码插入的形式来看基本能够分为下面3种:内联式.嵌入式和外部式三种. 1:内联式css样式表就是把css代码直接写在现有的HTML标签中,如以下代码: <p style="color:red";font-size:12px>这里文字是红色.</p> 2:嵌入式,嵌入式css样式.就是能够把css样式代码写在<style type="text/css">XXX</style>标签之间. <head&g

extjs 4 gridPanel 几种样式

简单表格 排序,显示某列,读取本地数据 //本地数据 var datas = [ ['1', 'gao', 'man'], ['2', 'gao', 'man'], ['3', 'gao', 'man'] ]; //创建面板 Ext.create('Ext.grid.Panel', { title: 'easy grid', width: 400, height: 300, renderTo: Ext.getBody(), frame: true, viewConfig: { forceFit:

UITableViewCell的几种样式

一.系统自己的UITableView样式有两种: 1.UITableViewStylePlain: Plain样式的是方形的,充满你给的view.frame坐标. 2.UITableViewStyleGrouped: Grouped样式主要是以圆角形显示.跟iphone自带的通讯录编辑页面类似. 二.系统自己的UITableViewCell样式有四种: 1.UITableViewCellStyleDefault: Default样式:左边一个显示图片的imageView,一个标题textLabe

1、HTML+DIV+CSS零基础快速入门到制作企业站视频课程_8 css 3种样式引用方法&lt;link&gt;&lt;style&gt;

0.行内样式添加CSS <p style="color: red;">这是一个段落</p> 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>css</title> 6 </head> 7 <body> 8 <p&

CSS基础知识(2)三种样式表的写法,块、行内、行内块元素之间的转换

margin: 0 auto /*可以让盒子居中*/1.三种样式表的书写方法 (1)内嵌式写法 特点:样式只作用于当前文件,没有真正实现结构表现分离. <head> <style type="text/css"> 样式表写法 </style></head> (2)外链式写法 特点:作用范围是当前站点,谁调用谁生效,范围广,真正实现结构表现分离. <link rel="stylesheet" href="

HTML--三种样式插入方法--链接---表格---列表

html三种样式表插入方法1.外部样式表---<link rel="styleheet" type="text/css" href="mystyle.css">2.内部样式表:--<style type="text/css> body{background-color:red} p{margin-left:20px}</style>3.内联样式表:<p style="color:red