SVG在Android和iOS上的评估

时间:2019-04-28 14:58:17

标签: android ios

我正在Android和iOS上开发两个本机应用程序。 对于最近的网站,我仅使用SVG,因为它具有更好的缩放质量和较小的文件大小。 在移动设备上这是否也可能并且被认为是好的做法,还是我应该坚持使用旧的PNG? 从我的初步研究中,我发现Android可以使用,<head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> .two{ float:left;width:50%;color:white;font-family:arial; } .one{ float:left;width:50%; } p{ color:white;padding:60px;text-align:justify;font-family:arial; } h2{ color:white;padding:20px;text-align:center; } .main{ background-color:black;height:40% } @media screen and (max-width :830px) { .one,.two,{ width:100%; float:none; } } </style> </head> <body> <div class="main"> <span class="one" > <img src="game.jpg" alt="Sorry,but this pic isn't available currently"style="width:100%;height:100%"></span> <span class="two" > <h2>"Gamers don't die, they respawn"</h2> <p>The status of gamer has finally shown some importance in the past few years and gaming has almost become common in the majority of economy. Famous blockbusters like Fortnite, PUBG, Warframe, Modern Combat and Rocket League are being released world-wide in order to encourage the ever- expanding envelope of technology and gaming.This website gives you reviews of such games and their download links along with other info.</p></span></div> </body> SVGKit可以用于iOS,但这可行吗?

2 个答案:

答案 0 :(得分:0)

在谈到此问题的iOS部分时,Apple支持基于矢量的资产,并积极鼓励将其用作工具栏,导航栏等上的图标的字形(基于矢量的单色模板)。您可以在此处查看更多详细信息在Custom Icons part of the Apple Human Interface Guidelines上。

也就是说,他们支持的标准格式(而不是SVG)是基于矢量的PDF(即仅包含基于矢量的内容的PDF文件)。如果您有兴趣,请在this question中对此进行更多讨论。各种工具(例如Adobe Illustrator和Affinity Designer)都支持直接导出到PDF(有关这些工具各自的教程,请参见herehere)。

编辑:如评论所述,您可以将矢量PDF与SVG here进行比较。

希望这会有所帮助。

答案 1 :(得分:0)

嘿,您可以在Android中使用 SVG 文件。 Android Studio将您的 SVG 矢量转换为 XML 矢量

以下是您将 SVG 文件导入 Android Studio

的过程

1)选择 Android 查看目录。

2)导航到应用> res > 可绘制

3)右键单击 drawable 文件夹。

4)选择新建> 矢量资产。   Asset Studio 对话框将会出现。

5)将“资产类型”设置为“ 本地文件”。

6)从路径部分选择您的 SVG 图像。

7)也可以执行其他操作,例如覆盖尺寸名称不透明等。


  

你很好。


对于 IOS ,您可以导入PDF文件以使用Scaleable