Fast Ways to Import Drawables in Android Studio

Fast ways to import drawables in Android Studio?

This became a lot easier since Android Studio 3.4.
Simply go to the Resource Manager-tab and click the little add-button add resources to the module.
[add button within resource manager[1]

Then select the drawables you would like to import.
If you placed the drawables in folders with the same name like the qualifiers (drawable-mdpi, drawable-hdpi. drawable-xhdpi and so on), the tool will automatically know were to add them.
drawables import dialog

The only thing still missing in my opinion is adding the drawables to a certain flavorDimension.

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

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

How to import set of icons into Android Studio project


Edit :
After Android Studios 1.5 android support Vector Asset Studio.


Follow this, which says:

To start Vector Asset Studio:

  1. In Android Studio, open an Android app project.
  2. In the Project window, select the Android view.
  3. Right-click the res folder and select New > Vector Asset.

Sample Image


Old Answer

Go to Settings > Plugin > Browse Repository > Search Android Drawable Import

This plugin consists of 4 main features.

  1. AndroidIcons Drawable Import
  2. Material Icons Drawable Import
  3. Scaled Drawable
  4. Multisource-Drawable

How to Use Material Icons Drawable Import : (Android Studio 1.2)

  • Go to File > Setting > Other Settings > Android Drawable Import

Sample Image

  • Download Material Icon and select your downloaded path.

Sample Image

  • Now right click on project , New > Material Icon Import

Sample Image

  • Use your favorite drawable in your project.

Sample Image

How to add an image to the drawable folder in Android Studio?

For Android Studio 1.5:

  1. Right click on res -> new -> Image Asset
  2. On Asset type choose Action Bar and Tab Icons
  3. Choose the image path
  4. Give your image a name in Resource name
  5. Next->Finish

Update for Android Studio 2.2:

  1. Right click on res -> new -> Image Asset

  2. On Icon Type choose Action Bar and Tab Icons

  3. On Asset type choose Image

  4. On Path choose your image path

  5. Next->Finish

The image will be saved in the /res/drawable folder.

Warning!
If you choose to use images other than icons in SVG or PNG be aware that it could turn grey if the image is not transparent. You can find an answer in comments for this problem but none of these are verified by me because I never encountered this problem. I suggest you to use icons from here: Material icons

Android Drawable Importer plugin not working in Android Studio 3.6

I found a repository that was Forked from the original plugin.
Vincent Loi created it! And is working fine in Android Studio 3.6.1! (and with Android studio 4.1.1)

Here is the repo android-drawable-importer-intellij-plugin

And here you can download the plugin.

Note from Vincent Loi:

This fork came about because the original package stopped working somewhere around Android Studio 3.5.
I have provided an installation zip here. As at 31Jan2020 it is known to run nicely on AS 3.6 RC 1. Any feedback would be appreciated.



Related Topics



Leave a reply



Submit