Android 自定义图形之xml画图

来源:互联网 发布:和孩子一起学编程 pdf 编辑:程序博客网 时间:2024/06/07 06:25
<?xml version="1.0" encoding="utf-8"?><vector xmlns:android="http://schemas.android.com/apk/res/android"        android:width="7.5dp"        android:height="14dp"        android:viewportHeight="28"        android:viewportWidth="15"><!--是声明的画布大小。-->    <group android:name="triableGroup">        <path            android:name="triangle"            android:fillColor="#4cffffff"            android:pathData="m 0,14 l 15,-14 0,28 z"/>        <!--M:move to 移动绘制点,作用相当于把画笔落在哪一点。        L:line to 直线,就是一条直线,注意,只是直线,直线是没有宽度的,所以你什么也看不到。        Z:close 闭合,嗯,就是把图封闭起来。        C:cubic bezier 三次贝塞尔曲线        Q:quatratic bezier 二次贝塞尔曲线        A:ellipse 圆弧        命令详解:M (x y) 把画笔移动到x,y,要准备在这个地方画图了。L (x y) 直线连到x,y,还有简化命令H(x) 水平连接、V(y)垂直连接。仅仅是连起来,并不会像笔画线一样显示图形。Z,没有参数,连接起点和终点C(x1 y1 x2 y2 x y),控制点(x1,y1)( x2,y2),终点x,y 。Q(x1 y1 x y),控制点(x1,y1),终点x,yC和Q会在下文做简单对比。A(rx ry x-axis-rotation large-arc-flag sweep-flag x y)android:pathData=" M50,50 a10,10 1,1 0 1,0" />rx ry 椭圆半径x-axis-rotation x轴旋转角度large-arc-flag 为0时表示取小弧度,1时取大弧度 (舍取的时候,是要长的还是短的)sweep-flag 0取逆时针方向,1取顺时针方向
参照:http://www.w2bc.com/article/132096        -->    </group></vector>
0 0
原创粉丝点击