Add all sizes of image asset in Android Studio with a PDF or Vector file

Micro

In iOS development with Xcode it is really convenient because you can add an image asset or launcher icon with one .pdf file and it generates all the necessary sizes automatically. The .pdf file can be created with Adobe Illustrator or a similar program that makes vector graphics.

Rather than sit there and export every size of icon/image asset one at a time, is there a fast way to add a vector image to Android Studio and have it populate all of the relevant sized folders on its own? Or in general, is there a way to accomplish the same thing in some way?

I have seen other posts where people suggest using an online tool that takes your .png image and lets you download a .zip with all of the different image sizes, but by definition, that method will not result in crisp and high quality image assets. You always want to go from a vector.

CommonsWare

is there a fast way to add a vector image to Android Studio and have it populate all of the relevant sized folders on its own?

Use File > New > Vector Asset in Android Studio 1.5 and higher. This will let you import an SVG file. Android Studio will attempt to convert it into a vector drawable resource, with varying degrees of success. If you are using a recent version of the Android Plugin for Gradle (1.5.0 or higher should work AFAIK), the build tools will also generate PNGs from the vector drawables for use on older devices (Android 4.4 and earlier).

but by definition, that method will not result in crisp and high quality image assets

You do not have much of a choice on older devices. There are a few deprecated backports of VectorDrawable floating around that you can try to use, but Google abandoned theirs.

You always want to go from a vector.

Not necessarily. Please bear in mind that not everybody has high-end mobile devices. Rendering SVG or other vector artwork is comparatively expensive, which is why Android did not directly support it (and still does not directly support SVG itself).

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Android Studio not loading image when creating new image asset

分類Dev

iOS Image Design (sizes and asset catalogs)

分類Dev

How to use desired font in Image Asset in Android Studio?

分類Dev

Android Studio Image Asset Launcherアイコンの背景色

分類Dev

All file sizes in KBs (Windows 10)

分類Dev

Android Studios not recognizing the asset file that I added

分類Dev

converting image to all sizes on upload vs resizing on request via php

分類Dev

Android Studio 3 (All Versions) - Device file explorer nothing to show

分類Dev

Why do we need to specific size during vector image generation in Android Studio?

分類Dev

Android Studio and PNG vector images

分類Dev

IMAGE VIEW ANDROID STUDIO

分類Dev

'Find All' in Android Studio

分類Dev

Convert image to PDF in Java Android

分類Dev

file:/// android_assetが機能しない

分類Dev

in android, trying to find text loaded from an asset file

分類Dev

File Explorer in Android Studio

分類Dev

How do I add an image in the drawable folder to an ImageView in Android Studio 1.2?

分類Dev

Android send mail with PDF file

分類Dev

TabBarItems and setting their image sizes?

分類Dev

iPhone Image sizes

分類Dev

Android : Rotate Vector Image to 90 degree

分類Dev

Preview PDF/Image file before upload

分類Dev

Android add border image to ImageView

分類Dev

Add gutter (binding margin) to existing PDF file

分類Dev

lp add file-path to pdf

分類Dev

Cordova svg <image xlink:href /> throwsリソースのロードに失敗しました:net :: ERR_FILE_NOT_FOUND [file:/// android_asset / www / undefined]

分類Dev

SVGがVector Asset Studioで読み込めないのはなぜですか

分類Dev

SVGがVector Asset Studioで読み込めないのはなぜですか

分類Dev

SVGがVector Asset Studioで読み込めないのはなぜですか

Related 関連記事

  1. 1

    Android Studio not loading image when creating new image asset

  2. 2

    iOS Image Design (sizes and asset catalogs)

  3. 3

    How to use desired font in Image Asset in Android Studio?

  4. 4

    Android Studio Image Asset Launcherアイコンの背景色

  5. 5

    All file sizes in KBs (Windows 10)

  6. 6

    Android Studios not recognizing the asset file that I added

  7. 7

    converting image to all sizes on upload vs resizing on request via php

  8. 8

    Android Studio 3 (All Versions) - Device file explorer nothing to show

  9. 9

    Why do we need to specific size during vector image generation in Android Studio?

  10. 10

    Android Studio and PNG vector images

  11. 11

    IMAGE VIEW ANDROID STUDIO

  12. 12

    'Find All' in Android Studio

  13. 13

    Convert image to PDF in Java Android

  14. 14

    file:/// android_assetが機能しない

  15. 15

    in android, trying to find text loaded from an asset file

  16. 16

    File Explorer in Android Studio

  17. 17

    How do I add an image in the drawable folder to an ImageView in Android Studio 1.2?

  18. 18

    Android send mail with PDF file

  19. 19

    TabBarItems and setting their image sizes?

  20. 20

    iPhone Image sizes

  21. 21

    Android : Rotate Vector Image to 90 degree

  22. 22

    Preview PDF/Image file before upload

  23. 23

    Android add border image to ImageView

  24. 24

    Add gutter (binding margin) to existing PDF file

  25. 25

    lp add file-path to pdf

  26. 26

    Cordova svg <image xlink:href /> throwsリソースのロードに失敗しました:net :: ERR_FILE_NOT_FOUND [file:/// android_asset / www / undefined]

  27. 27

    SVGがVector Asset Studioで読み込めないのはなぜですか

  28. 28

    SVGがVector Asset Studioで読み込めないのはなぜですか

  29. 29

    SVGがVector Asset Studioで読み込めないのはなぜですか

ホットタグ

アーカイブ