对于我的Android应用程序,我应该将图像转换为矢量(SVG)图像的XML文件吗?

huangapple go评论106阅读模式
英文:

For my Android App - should I convert images to XML Files of Vector (SVG) Images?

问题

我是一名自学的开发者,正在开发我的第二个Android应用。我的应用中有很多图片,我认为这可能会增加我的应用的大小。这些图片主要是.png或.webp文件。

我进行了一些研究,有一个建议是将图片转换为矢量图(这样我就不需要为各种屏幕密度创建多个图片)。我相信这些文件应该是.svg文件。

但是当我查看我的drawable文件夹时,我已经在使用许多XML文件,它们对我来说看起来像矢量文件。

我没有访问Illustrator的权限,所以我将不得不雇佣某人来协助。然而,我不确定是否应该要求他们将我的png文件转换为矢量(svg)文件还是具体转换为XML文件。有人可以帮助吗?

另外,我请求的所有图片都是相对基本的单色图片,比如设置图标、Facebook标志、导航箭头、椭圆等。

英文:

I'm a self taught developer and I'm working on my second Android app. My app has a lot images which I think my be inflating the size of my app. The images are mostly .png or .webp files.

I've been doing some research and one piece of advice was to convert images to vectors (so that I would have to create multiple images for various screen densities). I believe those files would be .svg files.

But when I look into my drawables folder, I'm already using numerous XML files, which look look vector files to me.

I don't have access to Illustrator, so I will have to hire someone to assist. However, I'm not sure if I should ask them to convert my png files to vector (svg) files or specifically to xml files. Can anyone assist?

Also, all the images I am requesting are relatively basic 1 color images, like a settings icon, facebook logo, navigation arrows, ovals, etc.

答案1

得分: 1

• 当SVG文件使用Android Studio转换为矢量可绘制文件时,文件大小为1KB。

• 我通常使用矢量可绘制文件作为底部导航图标。

• 并非所有的SVG文件都可以转换为矢量可绘制文件。这是一个大问题。即使你雇佣了某人,这仍然是一个问题。

• 一个解决方案是使用以下网站来压缩你的JPEG文件。

• 你也可以使用WebP来减小图像的大小。

• 你可以使用这个网站获取SVG图标。在下载后,你可以使用这个网站编辑这些SVG文件并去除水印。

过去,我曾经使用Adobe XD获取SVG图标,但有些图标无法成功转换。希望这对你有所帮助。

英文:

• When SVG is converted to Vector drawable using android studio file size is 1kb.

• I usually use Vector drawable for bottom nav icons.

Not all SVG files can be converted to vector drawable. That is a big problem. Even if you hire something this is still a problem.

• One solution is to use the following website to compress your jpeg.

• You can also use WebP to reduce the size of images.

• You can use this website to get SVG icons. After downloading it edit these svg and remove watermark from this website.

In the past, I have used adobe xd to get SVG icons. but some didn't convert successfully. I hope this will help you.

答案2

得分: 0

你可以通过使用Android Studio内置的Asset Studio生成自己的SVG来避免使用插画师,至少对于任何基本图标。它有很多有用的图像,你可能可以利用它们(一个典型的例子是设置图标)。

你可以通过右键单击drawable文件夹,然后导航到New -> Vector Asset来访问它。

这将打开Asset Studio窗口。如果你点击默认在“Clip art:”部分的任何图像,它将打开另一个窗口。

在这里,你可以搜索并过滤出你可能需要的图标。

如果你需要进一步自定义它们,你可以在从Asset Studio菜单中选择一个图标后设置它们的大小、颜色和不透明度,或者在生成它后手动修改xml文件。另一个快速提示是,在搜索图标时,你可以按“filled”、“outlined”、“round”、“sharp”和“two tone”进行过滤,这为你的使用情况提供了更进一步的自定义能力。

英文:

One way you avoid using an illustrator at least for any basic icons is by generating your own SVGs using Android Studio's built in Asset Studio. It has tons of useful images that you could probably utilize. (prime example would be a settings icon).

You can access it by right clicking the drawable folder then navigating to New -> Vector Asset.

对于我的Android应用程序,我应该将图像转换为矢量(SVG)图像的XML文件吗?

This will open the Asset Studio window. If you click on whatever image by default is in the "Clip art:" section it'll open another window

对于我的Android应用程序,我应该将图像转换为矢量(SVG)图像的XML文件吗?

Here you can search for and filter by whatever icons you may need.

对于我的Android应用程序,我应该将图像转换为矢量(SVG)图像的XML文件吗?

If you need to customize them further you can set their size, color, and opacity after selecting an icon from the Asset Studio menu, or just manually mess with the xml file after you've generated it. Another quick tip is that while searching for icons you can filter by "filled", "outlined", "round", "sharp", and "two tone", which provides even further customizability for whatever your use case is.

huangapple
  • 本文由 发表于 2023年8月9日 01:35:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76861966.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定