主要属性:

<?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. java对象比较==和equals的区别

    转载:http://blog.csdn.net/bluesky_usc/article/details/51849125 1值比较 即内容相同,我们就认为是相等的.比如:int i=5:int j = ...

  2. leetcode1013

    class Solution(object): def canThreePartsEqualSum(self, A: 'List[int]') -> bool: n = len(A) sums ...

  3. Linux下安装FTP服务(Ubuntu)

    在Ubuntu 14.04 上安装 FTP 服务 第一步>>更新库 linuxidc@linuxidc:~$ sudo apt-get update 第二步>>采用如下命令安装 ...

  4. golang web框架 beego

    尝试了下,在go环境ready的情况下,花了2分钟完成了beego安装.项目生成和启动,效率还是不错的 1.安装: go get github.com/astaxie/beego go get git ...

  5. centos 主机名突然变成bogon的解决方法

    主机名突然变成bogon,访问网络可能会出现问题(也可能没问题,我的就没问题),可能用到主机名的服务(比如说:mysql)可能也会出现访问不了.   所以我们需要解决以下问题,本人的解决方法: 主机名 ...

  6. 我要带徒弟学写JAVA架构,引路架构师之路(Jeecg开源社区)

    带徒弟学JAVA架构(Jeecg社区)      Java程序员如何打破工作2,3年的瓶颈问题,如何更上一层楼?      太多的巧合,让我接触到了开源,通过JEECG与很多朋友交流后,让我有了帮助别 ...

  7. day16-小数据池

    一,什么是代码块 Python程序是由代码块构造的.块是一个python程序的文本,他是作为一个单元执行的. 代码块:一个模块,一个函数,一个类,一个文件等都是一个代码块. 而作为交互方式输入的每个命 ...

  8. 03_JSX理解和使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. leetcode解题报告 32. Longest Valid Parentheses 用stack的解法

    第一道被我AC的hard题!菜鸡难免激动一下,不要鄙视.. Given a string containing just the characters '(' and ')', find the le ...

  10. vue 设置背景

    <span :style="{ 'background': 'url(' + aboutImg1 + ') no-repeat center center', 'background- ...