android:shape=["rectangle" | "oval" | "line" | "ring"]

shape的形状,默认为矩形,可以设置为矩形(rectangle)、椭圆形(oval)、线性形状(line)、环形(ring)

标签

corners ----------圆角
gradient ----------渐变
padding ----------内容离边界距离
size ------------大小 
solid  ----------填充颜色
stroke ----------描边

注意的是corners的属性bottomLeftRadius为右下角、bottomRightRadius为左下角

------------------------------------------------

下面的属性只有在android:shape="ring时可用:

android:innerRadius 尺寸,内环的半径。

android:innerRadiusRatio 浮点型,以环的宽度比率来表示内环的半径,

例如,如果android:innerRadiusRatio,表示内环半径等于环的宽度除以5,这个值是可以被覆盖的,默认为9.

android:thickness 尺寸,环的厚度

android:thicknessRatio 浮点型,以环的宽度比率来表示环的厚度,例如,如果android:thicknessRatio="2",

那么环的厚度就等于环的宽度除以2。这个值是可以被android:thickness覆盖的,默认值是3.

android:useLevel boolean值,如果当做是LevelListDrawable使用时值为true,否则为false.

-----------------------------------------------------------------------------------------

<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> <!--
圆角
android:radius 整型 半径
android:topLeftRadius 整型 左上角半径
android:topRightRadius 整型 右上角半径
android:bottomLeftRadius 整型 左下角半径
android:bottomRightRadius 整型 右下角半径
-->
<corners
android:radius="8dp"
android:topLeftRadius="5dp"
android:topRightRadius="15dp"
android:bottomLeftRadius="20dp"
android:bottomRightRadius="25dp"
/> <!--
渐变色
android:startColor 颜色值 起始颜色
android:endColor 颜色值 结束颜色
android:centerColor 整型 渐变中间颜色,即开始颜色与结束颜色之间的颜色
android:angle 整型 渐变角度(PS:当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。angle必须为45的整数倍)
android:type ["linear" | "radial" | "sweep"] 渐变类型(取值:linear、radial、sweep)
linear 线性渐变,这是默认设置
radial 放射性渐变,以开始色为中心。
sweep 扫描线式的渐变。
android:useLevel ["true" | "false"] 如果要使用LevelListDrawable对象,就要设置为true。设置为true无渐变。false有渐变色
android:gradientRadius 整型 渐变色半径.当 android:type="radial" 时才使用。单独使用 android:type="radial"会报错。
android:centerX 整型 渐变中心X点坐标的相对位置
android:centerY 整型 渐变中心Y点坐标的相对位置
-->
<gradient
android:startColor="#FFFF0000"
android:endColor="#80FF00FF"
android:angle="45"
/> <!--
内边距,即内容与边的距离
android:left 整型 左内边距
android:top 整型 上内边距
android:right 整型 右内边距
android:bottom 整型 下内边距
-->
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/> <!--
size 大小
android:width 整型 宽度
android:height 整型 高度
-->
<size
android:width="600dp"
/> <!--
内部填充
android:color 颜色值 填充颜色
-->
<solid
android:color="#ffff9d77"
/> <!--
描边
android:width 整型 描边的宽度
android:color 颜色值 描边的颜色
android:dashWidth 整型 表示描边的样式是虚线的宽度, 值为0时,表示为实线。值大于0则为虚线。
android:dashGap 整型 表示描边为虚线时,虚线之间的间隔 即“ - - - - ”
-->
<stroke
android:width="2dp"
android:color="#dcdcdc"
/>
</shape>

android:shape的更多相关文章

  1. android shape使用总结

    今天使用到shape,这个里面有很多属性,在这里我记录一下各个属性的使用的情况以及所代表的意思 <?xml version="1.0" encoding="utf- ...

  2. Android shape的使用(圆角矩形)

    <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http: ...

  3. android shape详解

    shape--> shape属性: rectangle: 矩形,默认的形状,可以画出直角矩形.圆角矩形.弧形等 solid: 设置形状填充的颜色,只有android:color一个属性 andr ...

  4. android shape(如自定义Button)

    Shape 前言:有时候会去自己去画一些Button的样式来展现在UI当中,其中主要用到的就是Shape 先来看一段代码: <?xml version="1.0" encod ...

  5. android shape的使用详解以及常用效果(渐变色、分割线、边框、半透明阴影效果等)

    shape使用.渐变色.分割线.边框.半透明.半透明阴影效果. 首先简单了解一下shape中常见的属性.(详细介绍参看  api文档 ) 转载请注明:Rflyee_大飞: http://blog.cs ...

  6. Android Shape画圆,矩形

    画圆环代码如下: 画圆环,外边的边界宽度大一点即可: <?xml version="1.0" encoding="utf-8"?> <shap ...

  7. ANDROID SHAPE画圆形背景_ANDROID实现角标布局

    ANDROID SHAPE画圆形背景_ANDROID实现角标布局 <?xml version="1.0" encoding="UTF-8"?> &l ...

  8. android shape总结 和控制的风格定制

    1:shape总结 1):shape文件是放置在drawable文件下的.res/drawable/filename.xml. 2):shape类型:android:shape. 一共同拥有四种:re ...

  9. [转]Android Shape渲染的使用(经典,学习研究不后悔)

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://mzh3344258.blog.51cto.com/1823534/1215749 ...

随机推荐

  1. c# winform TreeView NODE(节点) 重命名或获取节点修改后的值

    在程序开发过程中我们经常用到treeview,还经常要修改节点的名字.节点名字修改后还想及时更新数据库.这时问题就来了,怎样获取NODE(节点)更新后的值呢?本人试了很多方法最终分析出treeview ...

  2. SQLite 命令

    在shell下直接敲 sqlite3  进入sqlite命令行模式下(CLP的shell模式,CLP是sqlite3的命令行程序) sqlite3 -help (注意有空格)显示命令行模式下,sqli ...

  3. angular背景图片问题

    如果背景图片是从后台取得的数据,可以按下面的方式使用: ng-style="{'background':'url(http://xxx/{{item.id}})'}" 还需要加上  ...

  4. django1.7取消syncdb后不能创建model相应表的问题

    一.在运行一个django程序时,无法创建自定义model相应的表. 我检查seetings.py文件,发现自定义的app,blog已经写到INSTALLED_APPS中, INSTALLED_APP ...

  5. Python之路【第十七篇】:Django【进阶篇 】

    Python之路[第十七篇]:Django[进阶篇 ]   Model 到目前为止,当我们的程序涉及到数据库相关操作时,我们一般都会这么搞: 创建数据库,设计表结构和字段 使用 MySQLdb 来连接 ...

  6. TextView 中添加超链接

    在textView添加超链接,有两种方式,第一种通过HTML格式化你的网址,一种是设置autolink,让系统自动识别超链接,下面为大家介绍下这两种方法的实现   代码如下:    第一种    pu ...

  7. avalon2学习教程12数据验证

    avalon2砍掉了不少功能(如ms-include,ms-data),腾出空间加了其他更有用的功能.数据验证就是其中之一.现在avalon2内置的验证指令是参考之前的oniui验证框架与jquery ...

  8. jstl格式化数字

    jstl中的<fmt:formatNumber>标签   设置显示时间戳<%    request.setAttribute("currentTimeStamp" ...

  9. asp.net GDI+把图片绘制成自定义的椭圆形状

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  10. Spring MVC实例(增删改查)

    数据库配置文件application-context-jdbc.xml <?xml version="1.0" encoding="UTF-8"?> ...