主要属性:

<?xml version="1.0"encoding="utf-8"?>
<shape >
<corners />
<gradient />
<padding />
<size />
<solid />
<stroke />
</shape>

1、corners属性(圆角):

<corners
android:radius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="20dp"
android:bottomRightRadius="30dp"
android:bottomLeftRadius="40dp"/>

2、gradient属性(渐变色):

<gradient
android:type="radial"
android:angle="0"
android:startColor="@color/red"
android:centerColor="@color/green"
android:endColor="@color/white"
android:centerX="0.3"
android:centerY="0.5"
android:useLevel="false"
android:gradientRadius="200dp"/>

type:取值["linear" | "radial" | "sweep"]共有3中渐变类型,分别是线性渐变(默认)、放射渐变、扫描式渐变。

angle:仅对线性渐变有效,0为从左到右(逆时针旋转),必须为45的倍数,90为从下到上。

3、padding属性:

<padding

android:bottom="2dp"

android:left="3dp"

android:right="3dp"

android:top="2dp"/>

4、size属性:

<size

android:width="180dp"

android:height="100dp"/>

5、solid属性:

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

6、stroke属性(描边):

<stroke

android:width="5dp"

android:color="@color/red"

android:dashWidth="100dp"

android:dashGap="50dp"/>

7、shape属性:

<?xml version="1.0"encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:dither="false"
android:tint="@color/red"
android:tintMode="src_atop"
android:visible="true"
android:innerRadius="100dp"
android:innerRadiusRatio="20"
android:thickness="100dp"
android:thicknessRatio="6"
android:useLevel="false">
</shape>

shape 图形的更多相关文章

  1. shape图形的使用

    shape图形的使用 在项目中如果用到有规律的常规的图形,在能够掌握的前提下建议使用shape图形,shape图形相对与图片来说,占用资源更小,并且使用起来不会失真. 效果图 shape图形1 < ...

  2. android shape图形优化Button效果

    android shape可以让我们通过定义xml文件的方式创建图形,当然只能实现一些比较简单的图形(圆形,矩形,椭圆,线段),但是已经相当不错了,通过shape创建的图形作为控件的背景已经基本可以满 ...

  3. Android 中 shape 图形的使用

    转载于:http://kofi1122.blog.51cto.com/2815761/521605 Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shap ...

  4. 背水一战 Windows 10 (12) - 绘图: Shape, Path

    [源码下载] 背水一战 Windows 10 (12) - 绘图: Shape, Path 作者:webabcd 介绍背水一战 Windows 10 之 绘图 Shape - 图形 Path - 路径 ...

  5. Netron开发快速上手(一):GraphControl,Shape,Connector和Connection

    版权所有,引用请注明出处:<<http://www.cnblogs.com/dragon/p/5203663.html >> 本文所用示例下载FlowChart.zip 一个用 ...

  6. 绘图: Shape, Path

    Shape - 图形 Path - 路径 示例1.演示“Shape”相关知识点Drawing/Shape.xaml <Page x:Class="Windows10.Drawing.S ...

  7. 重新想象 Windows 8 Store Apps (18) - 绘图: Shape, Path, Stroke, Brush

    原文:重新想象 Windows 8 Store Apps (18) - 绘图: Shape, Path, Stroke, Brush [源码下载] 重新想象 Windows 8 Store Apps ...

  8. Android Drawable - Shape Drawable使用详解(附图)

    TIPS shape图形 –简单介绍 shape图形 –如何画? shape图形 –参数详细解析 shape图形 –如何用? shape图形 –实际开发应用场景 shape图形简单介绍 用xml实现一 ...

  9. FlasActionScript3随学随机

    1.跳转页面代码.下载代码(new URLRequest(下载地址)): var request1:URLRequest=new URLRequest("http://www.baidu.c ...

随机推荐

  1. Ubuntu12.04 内核树建立

    先查看自己使用的内核版本 lin@lin-virtual-machine:~$ uname -r --generic 如果安装系统时,自动安装了源码.在 /usr/src 目录下有对应的使用的版本目录 ...

  2. MySQL 创建自定义函数

    语法:Create function function_name(参数列表)returns返回值类型 函数体 函数名,应合法的标识符,不应与系统关键字冲突. 一个函数应该属于某个数据库,可以使用db_ ...

  3. English-旅游英语及情景对话

    1.旅游英语:预订机票情景对话及常用句型 目前,越来越多的人都选择以飞机为出行方式.但是如何用一口流利的英语订机票呢?这里我们替你总结了一些情景对话,还有一些常用的句型.大家都来学一学吧~A:Good ...

  4. 尚硅谷springboot学习15-日志框架1-入门

    引子 小张:开发一个大型系统 1.System.out.println(""):将关键数据打印在控制台:去掉?写在一个文件? ​ 2.框架来记录系统的一些运行时信息:日志框架 : ...

  5. Cookie安全小结

    Cookie机制:一般来说,同域内浏览器中发出的任何一个请求都会带上Cookie,无论请求什么资源,请求时,Cookie出现在请求头的Cookie字段中.服务端响应头的Set-Cookie字段可以添加 ...

  6. Kibana安装与基本用法(ELK)

    强制使用smtp 465端口加密发送邮件: vim kibana.yml 添加如下: sentinl: settings: email: active: true user: wjoyxt@.com ...

  7. Centos 下安装VIM编辑器

    我们在安装完Centos后,它默认的是安装了VI编辑器,VIM是没有安装的,所以我们在使用vim test.txt时会提示: vim command not found ... 这就是说明我们的Lin ...

  8. C++17尝鲜:编译期 if 语句

    Constexpr If(编译期 if 语句) 以 if constexpr 打头的 if 语句被称为 Constexpr If. Constexpr If 是C++17所引入的新的语法特性.它为C+ ...

  9. LeetCode OJ 93. Restore IP Addresses

    题目 Given a string containing only digits, restore it by returning all possible valid IP address comb ...

  10. 搭建分布式Hadoop的填坑纪录

    1 每个节点ssh免密连接本机 cd ~/.ssh/ # 若没有该目录,请先执行一次ssh localhost ssh-keygen -t rsa # 会有提示,都按回车就可以 cat id_rsa. ...