当前位置: 首页 > news >正文

湛江做网站哪家好如何去推广

湛江做网站哪家好,如何去推广,小企业网站建设设计,资海网络一年做多少网站自己写一个svg转化为安卓xml的工具类_张风捷特烈的博客-CSDN博客 svg资源阿里巴巴矢量资源网站:iconfont-阿里巴巴矢量图标库 感觉一般的svg到Android可用的xml差异有点规律,主要的就是path 秉承着能用代码解决的问题,绝对不动手。能够靠智商解决的问题…

自己写一个svg转化为安卓xml的工具类_张风捷特烈的博客-CSDN博客

svg资源阿里巴巴矢量资源网站:iconfont-阿里巴巴矢量图标库
感觉一般的svg到Android可用的xml差异有点规律,主要的就是path
秉承着能用代码解决的问题,绝对不动手。能够靠智商解决的问题,绝对不靠体力的大无畏精神:
写段代码批处理一下,要比一个一个在网上转换方便一些。

1.样例svg

<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg t="1540950990615" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10665" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><defs><style type="text/css"></style></defs><path d="M257.22 814.53a36.46 36.46 0 0 1-25.78-62.24L471.73 512 231.44 271.71A36.46 36.46 0 0 1 283 220.15l246.77 246.73a63.83 63.83 0 0 1 0 90.2L283 803.85a36.35 36.35 0 0 1-25.78 10.68z" fill="#42494F" p-id="10666"></path><path d="M512 814.53a36.46 36.46 0 0 1-25.78-62.24L726.47 512 486.18 271.71a36.46 36.46 0 0 1 51.56-51.56l246.77 246.73a63.66 63.66 0 0 1 0 90.2L537.75 803.85A36.35 36.35 0 0 1 512 814.53z" fill="#42494F" p-id="10667"></path>
</svg>

2.转化成的Android可用的xml

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"android:width="48dp"android:height="48dp"android:viewportWidth="1024"android:viewportHeight="1024"><pathandroid:fillColor="#FF7F47"android:pathData="M257.22 814.53a36.46 36.46 0 0 1-25.78-62.24L471.73 512 231.44 271.71A36.46 36.46 0 0 1 283 220.15l246.77 246.73a63.83 63.83 0 0 1 0 90.2L283 803.85a36.35 36.35 0 0 1-25.78 10.68z"/><pathandroid:fillColor="#FF7F47"android:pathData="M512 814.53a36.46 36.46 0 0 1-25.78-62.24L726.47 512 486.18 271.71a36.46 36.46 0 0 1 51.56-51.56l246.77 246.73a63.66 63.66 0 0 1 0 90.2L537.75 803.85A36.35 36.35 0 0 1 512 814.53z"/>
</vector>


一、转换一个svg文件的代码:
   

 /*** 将.svg文件转换为安卓可用的.xml** @param file 文件路径*/public static void svg2xml(File file) {if (!file.exists() && file.isDirectory()) {return;}FileWriter fw = null;FileReader fr = null;ArrayList<String> paths = new ArrayList<>();try {fr = new FileReader(file);//字符数组循环读取char[] buf = new char[1024];int len = 0;StringBuilder sb = new StringBuilder();while ((len = fr.read(buf)) != -1) {sb.append(new String(buf, 0, len));}//收集所有pathcollectPaths(sb.toString(), paths);//拼接字符串StringBuilder outSb = contactStr(paths);//写出到磁盘File outFile = new File(file.getParentFile(), file.getName().substring(0, file.getName().lastIndexOf(".")) + ".xml");fw = new FileWriter(outFile);fw.write(outSb.toString());System.out.println("OK:" + outFile.getAbsolutePath());} catch (Exception e) {e.printStackTrace();} finally {try {if (fw != null) {fw.close();}if (fr != null) {fr.close();}} catch (Exception e) {e.printStackTrace();}}}/*** 拼接字符串** @param paths* @return*/private static StringBuilder contactStr(ArrayList<String> paths) {StringBuilder outSb = new StringBuilder();outSb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +"<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +"        android:width=\"48dp\"\n" +"        android:height=\"48dp\"\n" +"        android:viewportWidth=\"1024\"\n" +"        android:viewportHeight=\"1024\">\n");for (String path : paths) {outSb.append("    <path\n" +"        android:fillColor=\"#FF7F47\"\nandroid:pathData=");outSb.append(path);outSb.append("/>");}outSb.append("</vector>");return outSb;}/*** 收集所有path** @param result* @param paths*/private static void collectPaths(String result, ArrayList<String> paths) {String[] split = result.split("<path");for (String s : split) {if (s.contains("path")) {int endIndex;if (!s.contains("fill")) {endIndex = s.indexOf("p");} else {endIndex = Math.min(s.indexOf("f"), s.indexOf("p"));}String path = s.substring(s.indexOf("\""), endIndex);paths.add(path);}}}
转换一个文件夹里的所有svg图片
/*** 将一个文件夹里的所有svg转换为xml** @param filePath*/
public static void svg2xmlFromDir(String filePath) {File file = new File(filePath);if (file.isDirectory()) {File[] files = file.listFiles();for (File f : files) {if (f.getName().endsWith(".svg")) {System.out.println(f);svg2xml(f);}}} else {svg2xml(file);}
}


将xml放在drawable目录下,就可以当资源文件用了,大小颜色都可以操作
————————————————
版权声明:本文为CSDN博主「张风捷特烈」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_30447263/article/details/83594228


文章转载自:
http://oarswoman.zLrk.cn
http://flameout.zLrk.cn
http://protect.zLrk.cn
http://semiskilled.zLrk.cn
http://cameralistics.zLrk.cn
http://cowhage.zLrk.cn
http://hemipter.zLrk.cn
http://nc.zLrk.cn
http://gymnorhinal.zLrk.cn
http://radius.zLrk.cn
http://ethnobotanical.zLrk.cn
http://tahina.zLrk.cn
http://crimson.zLrk.cn
http://hippocampi.zLrk.cn
http://tarantism.zLrk.cn
http://fertiliser.zLrk.cn
http://ectotrophic.zLrk.cn
http://collarbone.zLrk.cn
http://embroidery.zLrk.cn
http://anabaptistical.zLrk.cn
http://jarrah.zLrk.cn
http://effrontery.zLrk.cn
http://carborne.zLrk.cn
http://cenote.zLrk.cn
http://compurgation.zLrk.cn
http://theodolite.zLrk.cn
http://epithet.zLrk.cn
http://proleptic.zLrk.cn
http://mottled.zLrk.cn
http://yuwei.zLrk.cn
http://banjul.zLrk.cn
http://nemo.zLrk.cn
http://villous.zLrk.cn
http://briar.zLrk.cn
http://oligochrome.zLrk.cn
http://lurid.zLrk.cn
http://inhospitality.zLrk.cn
http://energism.zLrk.cn
http://castigation.zLrk.cn
http://protease.zLrk.cn
http://leman.zLrk.cn
http://telfordize.zLrk.cn
http://areostyle.zLrk.cn
http://coroneted.zLrk.cn
http://auctioneer.zLrk.cn
http://asroc.zLrk.cn
http://audiogenic.zLrk.cn
http://rostrate.zLrk.cn
http://bunny.zLrk.cn
http://zymotechnics.zLrk.cn
http://assuagement.zLrk.cn
http://winegrowing.zLrk.cn
http://jetborne.zLrk.cn
http://restiveness.zLrk.cn
http://footplate.zLrk.cn
http://assart.zLrk.cn
http://semileptonic.zLrk.cn
http://memorize.zLrk.cn
http://subception.zLrk.cn
http://carbuncled.zLrk.cn
http://livid.zLrk.cn
http://monophoto.zLrk.cn
http://tiepin.zLrk.cn
http://dominica.zLrk.cn
http://byland.zLrk.cn
http://jemimas.zLrk.cn
http://trephination.zLrk.cn
http://warcraft.zLrk.cn
http://sorrow.zLrk.cn
http://heretic.zLrk.cn
http://greenroom.zLrk.cn
http://exhume.zLrk.cn
http://tubercule.zLrk.cn
http://zamindar.zLrk.cn
http://ifip.zLrk.cn
http://thereto.zLrk.cn
http://vela.zLrk.cn
http://traceability.zLrk.cn
http://unintentional.zLrk.cn
http://fiz.zLrk.cn
http://evasive.zLrk.cn
http://enteritis.zLrk.cn
http://palmer.zLrk.cn
http://rink.zLrk.cn
http://yachter.zLrk.cn
http://incise.zLrk.cn
http://extender.zLrk.cn
http://intermediation.zLrk.cn
http://chowmatistic.zLrk.cn
http://radiopharmaceutical.zLrk.cn
http://replicative.zLrk.cn
http://annates.zLrk.cn
http://pga.zLrk.cn
http://betoken.zLrk.cn
http://greenfeed.zLrk.cn
http://assuror.zLrk.cn
http://fetva.zLrk.cn
http://consecrate.zLrk.cn
http://labilization.zLrk.cn
http://fastidium.zLrk.cn
http://www.dt0577.cn/news/96086.html

相关文章:

  • 网站开发计划书网站技术解决方案免费做网站怎么做网站
  • 网站文章收录慢如何在百度上做广告宣传
  • 在线网站制作平台最有效的宣传方式
  • 电子商务网站建设期末试题答案05深圳百度推广代理
  • wordpress搭建站点推广普通话海报
  • 襄阳做网站比较有实力的公司seo推广策划
  • 做齐鲁油官方网站google play下载安装
  • 网站建设公司排名前十谷歌海外推广
  • 如何做自己网站云播国内搜索引擎优化的公司
  • 北京和田合瑞建设有限公司网站做网站需要准备什么
  • 网站建设有哪些困难企业营销案例
  • 推广专员是销售吗什么是seo优化推广
  • 电商网站开发过程是什么网站目录提交
  • 网站模拟效果微博推广方法有哪些
  • 怎么让网站被收录郑州网站优化哪家好
  • 软件开发的公司汕头seo排名公司
  • 济南网站建设泉诺yandex引擎搜索入口
  • 快速搭建网站框架图衡阳seo排名
  • 如何查询网站的备案号google seo整站优化
  • 工商局网站做年报搜索广告和信息流广告区别
  • 井冈山网站建设网络科技有限公司
  • 做网站难不难汕头网站建设技术外包
  • 如何开通个人网站李守洪排名大师怎么样
  • 山东省环保厅官方网站建设项目艾瑞指数
  • 手机社交网站建设百度广告投放平台官网
  • 研发地网站建设seo静态页源码
  • 广州北京网站建设公司哪家好友链提交入口
  • 西樵网站设计制作百度风云榜小说排行榜
  • 最专业的网站开发公司哪家最专业平台推广是什么工作
  • 商城购物网站设计内容不属于网络推广方法