简体   繁体   English

Android Vector Asset太大了

[英]Android Vector Asset too big

I have an SVG that I'm using as the foreground for my adaptive icon. 我有一个SVG,我用它作为我的自适应图标的前景。 It's height and width are 128px128px. 它的高度和宽度是128px128px。 But when I go to drawable>New>Vector Asset and create an XML my viewportWidth is disproportionately large. 但是当我去drawable> New> Vector Asset并创建一个XML我的viewportWidth不成比例地大。

My icon instead of being nested inside my background instead takes up the whole page and cover even the background. 我的图标而不是嵌套在我的背景中,而是占据了整个页面,甚至覆盖了背景。 I tried using Inkscape and reduced the size of my SVG and sent it through drawable>New>Vector Asset again, but my icon is still gigantic, covering everything...but it's just a blurry blob. 我尝试使用Inkscape并减小了我的SVG的大小并再次通过drawable> New> Vector Asset发送它,但我的图标仍然是巨大的,涵盖了所有......但它只是一个模糊的blob。

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="1280"
android:viewportHeight="1280">

Don't use SVG for icon. 不要将SVG用于图标。 Download the highest resolution png for your icon. 下载图标的最高分辨率png Then add that to your minmap directory. 然后将其添加到您的minmap目录。 It will automatically generate icons of all sizes. 它会自动生成各种尺寸的图标。

Right click on minmap - > Image asset 右键单击minmap - > Image asset

There you can position the icon 在那里你可以定位图标

drawable>New>Vector Asset创建Vector时,选中Override选项并输入您想要的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM