Is there a built-in method to add drawable that is not an icon using Android Studio?

Issue

I know that I can right-click on res folder, select “New > Image asset” but while it allows me to select type of added icon it assumes that I want to add an icon.

I know that I can manually generate images and move them into drawble-mdpi, drawable-hdpi, drawable-xhdpi but I assume that it is possible to automate it and supply single image that will be scaled to create lower-resolution versions.

I know about Fast ways to import drawables in Android Studio? but it was not restricted to built-in options and an accepted version is plugin that received last update in 2016 and appears to be no longer maintained – NullPointerException report received no response from maintainer.

Solution

Unfortunately after posting and creating a bounty, I found that it was already asked as Is there a way to create xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale image?

Therefore Is there a way to create xxhdpi, xhdpi, hdpi, mdpi and ldpi drawables from a large scale image? has some useful options quoted below:

Option #1: Just ship the -xxhdpi drawables and let Android downsample them for you at runtime (downside: will only work on fairly recent devices, where -xxhdpi is known).

Option #2: Automate the process within a graphics editor, per ssantos’ answer.

Option #3: Script yourself a solution, using something like ImageMagick

(answers by CommonsWare)

I followed option #3

Answered By – reducing activity

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published