How to import set of icons into Android Studio project

164,750

Solution 1


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.

enter image description here


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

enter image description here

  • Download Material Icon and select your downloaded path.

enter image description here

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

enter image description here

  • Use your favorite drawable in your project.

enter image description here

Solution 2

Actually if you downloaded the icons pack from the android web site, you will see that you have one folder per resolution named drawable-mdpi etc. Copy all folders into the res (not the drawable) folder in Android Studio. This will automatically make all the different resolution of the icon available.

Solution 3

For custom images you created yourself, you can do without the plugin:

Right click on res folder, selecting New > Image Asset. browse image file. Select the largest image you have.

It will create all densities for you. Make sure you select an original image, not an asset studio image with an alpha, or you will semi-transpartent it twice.

Solution 4

Since Android Studio 3.4, there is a new tool called Resource manager. It supports importing many drawables at once (vectors, pngs, ...) . Follow the official documentation.

Solution 5

just like Gregory Seront said here:

Actually if you downloaded the icons pack from the android web site, you will see that you have one folder per resolution named drawable-mdpi etc. Copy all folders into the res (not the drawable) folder in Android Studio. This will automatically make all the different resolution of the icon available.

but if your not getting the images from a generator site (maybe your UX team provides them), just make sure your folders are named drawable-hdpi, drawable-mdpi, etc. then in mac select all folders by holding shift and then copy them (DO NOT DRAG). Paste the folders into the res folder. android will take care of the rest and copy all drawables into the correct folder.

Share:
164,750
GyRo
Author by

GyRo

Former Java developer. Loves technology but keep an open eye that it won't take over humanity

Updated on July 05, 2022

Comments

  • GyRo
    GyRo almost 2 years

    I downloaded collection of icons from Android Developers center Each icon in this collection is ordered in forlders according to its resolution: drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi.

    Is there a way to import all the 4 icon's files in one action to Android Studio or I need to copy it one by one? (when I used new->Image Asset , I had to fill a file path, I couldn't fill it with folder path)

    Update 25/2/15:
    According to this SO question, seems like there is a way to generate the 4 size of icons by Android Asset Studio, and then import the zip file directly to your Android Studio project res folder - has anyone used it?

  • GyRo
    GyRo about 9 years
    I installed it but can't use it. I have to provide through IDE settings-->Android Drawable Importer - a path to the asset's home folder but there is no way to edit the field to provide this folder path. besides I don't know what's my project's asset's folder. It only have the icons under res\drawable-mdpi, res\drawable-hdpi, etc.
  • Kishan Vaghela
    Kishan Vaghela about 9 years
    U have to provide your downloaded icon folder path not your assets folder
  • Kishan Vaghela
    Kishan Vaghela about 9 years
    U can download Material Icon from github.com/google/material-design-icons/releases and use downloaded folder path
  • Frank
    Frank about 9 years
    and then what, how do I use this plugin? Right clicking the drawable folder gives me nothing.
  • Kishan Vaghela
    Kishan Vaghela about 9 years
    Right Click > New > Select your Configured option for this plugin
  • GyRo
    GyRo about 9 years
    Eventually I figured that it this is what I've been looking for. I am using the option new->scaled drawable that was added by this plugin, in order to import images to Android Studio. Thanks!
  • Shajeel Afzal
    Shajeel Afzal about 9 years
    @KishanVaghela can you please explain how to set the path of Material icos root folder for Android Drawable Importer plugin?
  • Shajeel Afzal
    Shajeel Afzal about 9 years
    @KishanVaghela thank you so much for the Edit, it is much more clear and easy now.
  • boltup_im_coding
    boltup_im_coding almost 9 years
    The Image Asset tool leaves a transparent border around my files, resulting in smaller icons than the rest of the ones on the phone. Have you found a way to mitigate that?
  • Frank
    Frank over 8 years
    It does, I asked him to make this padding optional in the next version.
  • Evgeniy Mishustin
    Evgeniy Mishustin over 8 years
    In Android Studio 1.3 the plugin (as the field Other Settings) doesn't appear under the Settings
  • Kishan Vaghela
    Kishan Vaghela over 8 years
    @LuciusHipan This screenshots from Android Studio 1.2, If you have Android Studio v1.3 or above you can find from search.
  • Evgeniy Mishustin
    Evgeniy Mishustin over 8 years
    @Kishan Vaghela, thank you. In Android Studio 1.3 you can simply skip this step. After you download plugin and restart the studio, the plugin appears already in the "New" section (imho it downloads the icons in the runtime)
  • SweetWisher ツ
    SweetWisher ツ about 8 years
    There is no way to give transparent background in Android Studio 2.0.
  • edwoollard
    edwoollard almost 8 years
    @KishanVaghela Is there a way to get grey icons? I don't want just black and white and lots of the default Android icons are in a dark grey.
  • Barry Staes
    Barry Staes over 7 years
    In Android Studio 2.2 theres an option to add icons from the icon set. Rightclick the res folder and choose New > Image Asset. You are now in "Asset Studio" where you can simply select a theme and clipart and Bob's your uncle.
  • Marwan Salim
    Marwan Salim almost 6 years
    This is the best solution and yet simple. For the icons pack, I generate from makeappicon.com
  • Marwan Salim
    Marwan Salim almost 6 years
    For the location C:\Users\<your_username>\AndroidStudioProjects\<your_project‌​_name>\app\src\main\‌​res