在 Android 中使用 SVG 的最简单方法? [英] Easiest way to use SVG in Android?

查看:45
本文介绍了在 Android 中使用 SVG 的最简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了在 Android 中使用 svg 并避免令人沮丧地创建不同的分辨率和为每个分辨率丢弃文件,我发现了无数的库,当应用程序有很多图标或图像时,这会变得非常烦人.

I have found a myriad of libraries in order to use svg in Android and avoid the frustrating creation of different resolutions and dropping files for each resolution, this becomes very annoying when the app has many icons or images.

任何人都可以提供在 Android 中使用 SVG 的最简单使用库的分步过程,我相信这也会对其他人有所帮助.

Can anyone be as kind to give a step by step process of the simplest to use library for using SVG in Android, I'm sure this will help many others too.

我还使用 Android Studio 和 Illustrator 来生成我的图标和图像.

Also I use Android Studio and Illustrator for generating my icons and images.

推荐答案

首先,您需要通过以下简单步骤导入 svg 文件.

First you need to import svg files by following simple steps.

  1. 右键单击项目的可绘制文件夹 (app/res/drawable)
  2. 点击新建
  3. 选择矢量资源

如果图像在您的计算机中可用,则选择本地 svg 文件.之后,选择图像路径,如果需要,对话框右侧也提供更改图像大小的选项.通过这种方式,svg 图像被导入到您的项目中.

If image is available in your computer then select local svg file. After that select the image path and an option to change the size of the image is also available at the right side of dialog if you want to. In this way svg image is imported in your project.

之后使用此图像使用相同的程序:

After that for using this image use the same procedure:

@drawable/yourimagename

这篇关于在 Android 中使用 SVG 的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆