大家好,pls call me francis. nice to me you.

本文将介绍使用在Android中使用shape标签绘制drawable资源图片。

下面的代码是shap标签的基本使用情况:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<!-- android:shape属性值有:rectangle(矩形)(默认值)、oval(椭圆形)、line(线条)、ring(环形)--> <!-- graditent(渐变),绘制色彩渐变效果 -->
<gradient android:angle="" android:endColor="#000000" android:centerColor="#777777" android:startColor="#ffffff"/> <!-- corners(拐角、角点)绘制边角圆滑效果 -->
<corners android:radius="30dp"/> <!-- padding(内边距、补白、填补)绘制文本内容与此drawable的内边距,有留白效果 -->
<padding android:left="10dp"/> <!-- solid(实心)填充色彩 -->
<solid android:color="#ff0000"/> <!-- stroke(笔画) 绘制边框效果--> <!-- android:dashWidth表示虚线的长度、android:dashGap表示虚线的间隔距离 -->
<stroke android:width="5dp" android:color="#00ff00" android:dashWidth="30dp" android:dashGap="2dp"/> </shape>

这就是shape制作drawable资源的过程,就这是一张drawable图片。图片已制作完毕!
接下来,我们就来使用看它,将上面的这份代命名为:shape_ring.xml。

我们只要是layout布局中如此使用即可:android:background="@drawable/shape_ring"。

Ok啦,上面就是我们学习的整个过程了。

简单了吧^_^.

附上效果图:

Android系列:res之shape制作的更多相关文章

  1. Android:res之shape制作圆角、虚线、渐变

    xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...

  2. Android必知必会--使用shape制作drawable素材

    前言 最近看到朋友制作的Android APP使用了极少的图片,但是图形却极其丰富,问了之后得知是使用shape绘制的,有很多优点. 下面是我整理的一些素材: 预览 下面是图片预览: 代码 布局文件 ...

  3. Android:使用shape制作素材

    最近看到朋友制作的Android APP使用了极少的图片,但是图形却极其丰富,问了之后得知是使用shape绘制的,有很多优点. 下面是我整理的一些素材: 预览 下面是图片预览: 代码 布局文件 < ...

  4. Android shape制作圆角、虚线、渐变

    xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角 gradient ---------- ...

  5. Android res之shape

    xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...

  6. Android中使用shape制作一个旋转的progressbar

    public class ZNtestResActivity extends Activity { @Override public void onCreate(Bundle savedInstanc ...

  7. [转]Android样式的开发:shape篇

    转载自Keegan小钢原文链接:http://keeganlee.me/post/android/20150830 Android样式的开发:shape篇Android样式的开发:selector篇A ...

  8. Android系列之网络(三)----使用HttpClient发送HTTP请求(分别通过GET和POST方法发送数据)

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...

  9. Android系列之网络(二)----HTTP请求头与响应头

    ​[声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/ ...

随机推荐

  1. iOS SpriteKit 问题

    今天偶然发现 向SKShapeNode添加子 node时,子node参考的是 SKShapeNode的parent的坐标系,但是如果使用SKSpriteNode却是使用自己的坐标系,带研究.而且sha ...

  2. 在桌面程序上和Metro/Modern/Windows store app的交互(相互打开,配置读取)

    这个标题真是取得我都觉得蛋疼..微软改名狂魔搞得我都不知道要叫哪个好.. 这边记录一下自己的桌面程序跟windows store app交互的过程. 由于某些原因,微软的商店应用的安全沙箱导致很多事情 ...

  3. c++顺序表基本功能

    头文件 #define LIST_MAX_SIZE 5#define LISTINCREMENT 2#include<assert.h>#include<string>temp ...

  4. myeclipse实现包的分层显示

  5. October 30th Week 45th Sunday 2016

    Genius is nothing but labor and diligence. 天才不过是勤奋而已. Labor and diligence are the requirements for s ...

  6. Java实现画八卦

    八卦是由多个圆叠加而成,如果我们让每个圆都有自己的颜色,那么具体结构便一目了然,如下图所示: 显然只要令对应的圆颜色相同,就能达到我们预期的效果. 用Java就能轻松画出来: import java. ...

  7. tif文件导入postgresql

    raster2pgsql -I -F -N -999  文件名  数据库名 | psql -U postgres -d postgres

  8. ***PHP 数组排序 +php二维数组排序方法(PHP比较器)

    PHP - 一维数组的排序函数 在本节中,我们将学习如下 PHP 数组排序函数: sort() - 以升序对数组排序 rsort() - 以降序对数组排序 asort() - 根据值,以升序对关联数组 ...

  9. 在Mac上开启自带的Apache,httpd服务

    下面演示的是Mac自带的httpd服务 启动httpd服务 AppledeMacBook-Pro:python2_zh apple$ sudo apachectl start AppledeMacBo ...

  10. JAVA基础(一)

    1.Java class中的static修饰的成员表面其属于该类所共有,而不是属于某个实例.static修饰的成员不能直接调用非static修饰的成员. 2.Java构造器不能定义返回类型,也不能使用 ...