drawable文件夹里添加Vector Asset

M表示绘制的起点,比如绘制的图标大小为24x24,那么x轴y轴的中点为12,
Z表示将最后一个点和第一个点连起来
L表示连线到该点坐标,大写L或不写表示绝对坐标,小写l表示相对坐标。

绘制多笔可以分几个path也可写在一个path

<vector android:height="24dp"android:viewportHeight="24.0" android:viewportWidth="24.0"android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"><path android:fillColor="#FF4421" android:pathData="M12,1 l-3,4 l6,0 z"/><path android:fillColor="#03A9F4" android:pathData="M12,5 l-3,4 l6,0 z"/><path android:fillColor="#FFEB3B" android:pathData="M12,9 l-3,4 l6,0 z"/>
</vector>

绘制绿色对勾

<pathandroid:name="check"android:pathData="M4,10 L12,16 L20,4"android:strokeColor="#35931d"android:strokeWidth="3" />

绘制爱心

<pathandroid:name="check"android:pathData="M6,10 L12,16 L18,10 "android:strokeLineCap="round"android:strokeColor="#FE1300"android:strokeAlpha="200"android:strokeWidth="10" />

绘制弧形
a(圆的x轴半径,y轴半径,x轴旋转角度,0/1-小/大弧度,0/1-逆/顺时针,圆的终点位置x点,圆的终点位置y点)
x轴旋转角度不起作用。

  <pathandroid:name="check"android:pathData="M12,12 a4,4 0 1 0 2,3"android:strokeLineCap="round"android:strokeColor="#FE1300"android:strokeAlpha="180"android:strokeWidth="1" />-->

绘制圆角矩形

    <pathandroid:fillColor="#8A8181"android:name="check"android:pathData="M16,3 L4,3 a3,3 0 0 0 -3,3 L1,18 a3,3 0 0 0 3,3 L16,21 a3,3 0 0 0 3,-3 L19,6 a3,3 0 0 0 -3,-3 "android:strokeLineCap="round"android:strokeColor="#FE1300"android:strokeWidth="1" />

res下新建animator文件夹,新建vector assests文件animtor.xml

<?xml version="1.0" encoding="utf-8"?>
<objectAnimatorxmlns:android="http://schemas.android.com/apk/res/android"android:duration="@android:integer/config_longAnimTime"android:propertyName="pathData"android:valueFrom="@string/round1"android:valueTo="@string/square1"android:valueType="pathType"/>

string.xml

 <string name="round1" translatable="false"> m 109.0, 27.0 h 0.0 c 45.29,0.0,82.0,36.71,82.0,82.0 v 0.0 c 0.0,45.29,-36.71,82.0,-82.0,82.0 h 0.0 c -45.29,0.0,-82.0,-36.71,-82.0,-82.0 v 0.0 c 0.0,-45.29,36.71,-82.0,82.0,-82.0 L 109.0,27.0z</string><string name="square1" translatable="false">m 80.0, 69.0 h 60.0 c 5.52,0.0,10.0,4.48,10.0,10.0 v 60.0 c 0.0,5.52,-4.48,10.0,-10.0,10.0 h -60.0 c -5.52,0.0,-10.0,-4.48,-10.0,-10.0 v -60.0 c 0.0,-5.52,4.48,-10.0,10.0,-10.0 L 80.0,69.0z</string>

drawable/button_ready.xml

<vector android:height="100dp" android:viewportHeight="218"android:viewportWidth="218" android:width="100dp" xmlns:android="http://schemas.android.com/apk/res/android"><pathandroid:fillAlpha="0.5"android:fillColor="#000"android:name="椭圆 10 拷贝 2"android:pathData="m109.5 5c57.71 0 104.5 46.79 104.5 104.5c0 57.71 -46.79 104.5 -104.5 104.5c-57.71 0 -104.5 -46.79 -104.5 -104.5c0 -57.71 46.79 -104.5 104.5 -104.5z"/><pathandroid:fillColor="#fff"android:name="c1"android:pathData="m109 16c51.36 0 93 41.64 93 93c0 51.36 -41.64 93 -93 93c-51.36 0 -93 -41.64 -93 -93c0 -51.36 41.64 -93 93 -93zm0 -16c-60.2 0 -109 48.8 -109 109c0 60.2 48.8 109 109 109c60.2 0 109 -48.8 109 -109c0 -60.2 -48.8 -109 -109 -109z"/><pathandroid:fillColor="#ff2f51"android:name="c2"android:pathData="@string/round1"/>
</vector>

drawable/recoder_animator.xml

<?xml version="1.0" encoding="utf-8"?>
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"android:drawable="@drawable/button_ready"><targetandroid:animation="@animator/anim_in"android:name="c2"/></animated-vector>

activity_main.xml

    <ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/recoder_animator"android:id="@+id/round"/>

android绘制矢量图标和动画相关推荐

  1. android绘制矢量图_Android矢量可绘制对象

    android绘制矢量图 Everything about Vector Assets in Android 关于Android中的矢量资产的一切 介绍 (Introduction) In the b ...

  2. android绘制矢量图_Android矢量可绘制

    android绘制矢量图 In this tutorial, we'll be discussing Android Vector Drawable. Furthermore, we'll be im ...

  3. Android VectorDrawable 矢量图+属性动画 使用总结

    代码已经同步到GitHub 然后看一下效果图: 前两个图标是让android的组件使用VectorDrawable 后面的是动画效果 后面会详细介绍. 什么是VectorDrawable Vector ...

  4. Android 绘制电池图标

    效果图: 代码 public class BatteryView extends View {private int mMargin = 30; //电池内芯与边框的距离private int mBo ...

  5. 做ppt,字体图标音效动画,资源地址收藏

    音效字体图片图标动画 音效 Sound Effects Download | Soundsnap.com Royalty Free Sound Effects (FX) Library for Dow ...

  6. Android绘制(三):Path结合属性动画, 让图标动起来!

    Android绘制(一):来用shape绘出想要的图形吧! Android绘制(二):来用Path绘出想要的图形吧! 目录 效果图 前言 绘制 属性动画 最后 效果图 不废话, 直接上效果图, 感兴趣 ...

  7. android 字母path动画,Android绘制(三):Path结合属性动画, 让图标动起来!

    目录 效果图 前言 绘制 属性动画 最后 效果图 不废话, 直接上效果图, 感兴趣再看下去. 其实不单单是效果图演示的, 运用熟练的话各种图标之间都是可以切换的. 暂停到终止 暂停到播放 前言 之前的 ...

  8. [译] 绘制路径:Android 中矢量图渲染

    原文地址:Draw a Path: Rendering Android VectorDrawables 原文作者:Nick Butcher 译文出自:掘金翻译计划 本文永久链接:github.com/ ...

  9. Android svg矢量图实现心跳动画

    文章目录 将svg转化为xml文件 给每个path设置动画 要实现的效果如下: 将svg转化为xml文件 阿里巴巴矢量图标库iconfont:https://www.iconfont.cn/ 我们需要 ...

最新文章

  1. python开发的比较知名的游戏-游戏排行榜-Python实现
  2. 非MFC工程中使用MFC库
  3. 内存的静态分配和动态分配的区别【转】
  4. MySql 的一些使用小技巧
  5. 计算机字符编码详尽讲解
  6. 她是如何从传统金融行业转行产品经理的?
  7. cmake学习笔记(2)--CMake常用的预定义变量
  8. Centos7安装Docker(二进制)
  9. Meteor资源国外优秀web APP 收藏
  10. Python获取路径中的文件名
  11. 如何将wav转为mp3格式,wav中间mp3步骤
  12. 为什么c语言运行后输入的中文会乱码
  13. pycaret 2 1新增功能
  14. 计算机xp怎样连接internet,XP系统电脑怎么连接无线WIFI网络,涨知识了
  15. vue中的几个动效网站
  16. 因子模型套利定价理论APT的应用
  17. 《MySQL学习》 索引 下 覆盖索引,MRR,联合索引
  18. 嵌入式开发学习之--RCC(上)
  19. Python图像锐化及边缘检测(Roberts、Prewitt、Sobel、Lapllacian、Canny、LOG)
  20. Ubuntu18.04安装ROS最后的rosdep update不成功解决方案(亲测可行)

热门文章

  1. Linux搭建各种常用服务器(详细)
  2. 微信小程序禁用页面下拉,且局部上下滚动不卡顿
  3. 有想法就去实现,外汇英镑近期走势
  4. centerOS各种问题(Xshell链接不上虚拟机)
  5. [算法前沿]--029-Transformers的生成任务-摘要生成
  6. Linux下使用Quagga(Zebra)搭建路由器记录(转)
  7. codecombat计算机科学入门三(Python)
  8. Qt操作EXCEL设置自动筛选
  9. 对于元宇宙建设者来说,用户体验与互操作性谁才是最重要的?
  10. Tapestry携旗下三大品牌及众多首发新品再赴“进博之约”