Android Studio 1.3 SVG 到 PNG 的转换 [英] Android Studio 1.3 SVG to png conversion
问题描述
在最近的 google IO 2015 中,google 宣布新的 Android Studio 1.3/新的 gradle 插件将支持导入和 SVG 文件,构建系统将为不同的设备密度(hdpi、xhdpi、xxhdpi 等)生成资产:
In recent google IO 2015, google announced that the new Android Studio 1.3/ new gradle plugin will have support for importing and SVG file and the build system will generate the assets for different device densities (hdpi, xhdpi, xxhdpi etc):
http://robovm.com/google-io-summary-whats-new-in-android-development-tools/ https://www.youtube.com/watch?v=f7ihSQ44WO0&feature=youtu.be&t=2m46s
Unfortunately there doesnt seem to be more information about how to achieve that. Does any one have any more details about it?
There is some mention of it in : Android: Using SVG in res leads to error: "The file name must end with .xml or .png"
and I tried to create a hello world app and places an svg file (renamed it to xml in the drawable folder). it compiled and installed on the device, but crashed during execution saying svg is not a vlaid tag. suppose the original file needs more conversion.
To add a new vector asset right click on your drawable folder in Android Studio and choose New > Vector asset. Please note that you need Gradle 1.4 or newer to use vector assets with projects with a build target lower than 21. In this case Gradle will convert the vector images to PNGs at build time.
The current beta version of Gradle 1.4 has some issues with opening keystores when releasing an apk, so before importing a lot of vector images, try to release your app first (this is only my personal experience with Gradle 1.4.0-beta6, Gradle will report a tampered keystore, e.g. see here)
这篇关于Android Studio 1.3 SVG 到 PNG 的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!