android怎么将drawable下vector asset文件.xml转成svg
项目背景:
近期项目组要在Android7.1设备上跑5G通信,对于Android端工作就是bsp适配好模块后将5G信号类型添加到系统中。主要Android原生只有234G信号类型还是svg转过后,原生没有svg图片。公司还没有ui。。。。。。。在这样的环境下只能想办法把.xml转正svg然后ps大法。
svg介绍参考链接: svg介绍.
svgAndroid使用: svg Android使用.
Android vector asset示例:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="32dp"
android:viewportWidth="16"
android:viewportHeight="32">
<path
android:fillColor="#FF000000"
android:pathData="M11.9,9.9c-0.2,0.4 -0.6,0.7 -1,0.9s-1,0.4 -1.8,0.4c-0.9,0 -1.7,-0.3 -2.2,-0.8S6.1,9 6.1,7.9V5.6c0,-1.1 0.3,-1.9 0.8,-2.4S8.1,2.4 9,2.4c1,0 1.7,0.2 2.1,0.7s0.7,1.2 0.7,2.1h-1.6c0,-0.5 -0.1,-0.9 -0.2,-1.1S9.5,3.7 9,3.7c-0.4,0 -0.7,0.2 -0.9,0.5S7.7,5 7.7,5.6v2.3C7.7,8.6 7.8,9 8,9.3c0.2,0.3 0.6,0.5 1,0.5c0.3,0 0.6,0 0.7,-0.1s0.3,-0.2 0.4,-0.3V7.8H9V6.6h2.9V9.9z"/>
<path
android:fillColor="#FF000000"
android:pathData="M0.2,8.6l1.4,-0.2c0,0.4 0.2,0.7 0.4,0.9s0.4,0.3 0.7,0.3s0.6,-0.1 0.8,-0.4C3.7,8.9 3.8,8.5 3.8,8S3.7,7.1 3.5,6.8C3.3,6.6 3,6.4 2.7,6.4C2.3,6.4 1.9,6.6 1.6,7L0.4,6.9l0.7,-4.4H5V4H2.2L2,5.4c0.3,-0.2 0.7,-0.3 1,-0.3c0.6,0 1.2,0.3 1.6,0.8s0.7,1.2 0.7,2c0,0.7 -0.2,1.3 -0.5,1.9c-0.5,0.7 -1.2,1.1 -2,1.1S1.5,10.7 1,10.3S0.3,9.3 0.2,8.6z"/>
</vector>
svg图片示例:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 32" style="enable-background:new 0 0 16 32;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
</style>
<path d="M11.9,9.9c-0.2,0.4-0.6,0.7-1,0.9s-1,0.4-1.8,0.4c-0.9,0-1.7-0.3-2.2-0.8S6.1,9,6.1,7.9V5.6c0-1.1,0.3-1.9,0.8-2.4
S8.1,2.4,9,2.4c1,0,1.7,0.2,2.1,0.7s0.7,1.2,0.7,2.1h-1.6c0-0.5-0.1-0.9-0.2-1.1S9.5,3.7,9,3.7c-0.4,0-0.7,0.2-0.9,0.5
S7.7,5,7.7,5.6v2.3C7.7,8.6,7.8,9,8,9.3c0.2,0.3,0.6,0.5,1,0.5c0.3,0,0.6,0,0.7-0.1s0.3-0.2,0.4-0.3V7.8H9V6.6h2.9V9.9z"/>
<g>
<path d="M0.2,8.6l1.4-0.2c0,0.4,0.2,0.7,0.4,0.9s0.4,0.3,0.7,0.3s0.6-0.1,0.8-0.4C3.7,8.9,3.8,8.5,3.8,8S3.7,7.1,3.5,6.8
C3.3,6.6,3,6.4,2.7,6.4C2.3,6.4,1.9,6.6,1.6,7L0.4,6.9l0.7-4.4H5V4H2.2L2,5.4c0.3-0.2,0.7-0.3,1-0.3c0.6,0,1.2,0.3,1.6,0.8
s0.7,1.2,0.7,2c0,0.7-0.2,1.3-0.5,1.9c-0.5,0.7-1.2,1.1-2,1.1S1.5,10.7,1,10.3S0.3,9.3,0.2,8.6z"/>
</g>
<rect id="_x3C_切片_x3E_" class="st0" width="16" height="32"/>
</svg>
Vectorasset怎么转svg呢? 参考.
android:pathData replaced with d
android:fillColor replaced with fill
android:strokeColor replaced with stroke
android:strokeWidth replaced with stroke-width
android:fillType replaced with fill-rule
A path in the VectorDrawable without fillColor is fill="none" in SVG.
android:viewportHeight="24" android:viewportWidth="24" is viewBox="0 0 24 24" in SVG.
835



被折叠的 条评论
为什么被折叠?



