How to import set of icons into Android Studio project
Solution 1
Edit : After Android Studios 1.5 android support Vector Asset Studio.
Follow this, which says:
To start Vector Asset Studio:
- In Android Studio, open an Android app project.
- In the Project window, select the Android view.
- Right-click the res folder and select New > Vector Asset.
Old Answer
Go to Settings > Plugin > Browse Repository > Search Android Drawable Import
This plugin consists of 4 main features.
- AndroidIcons Drawable Import
- Material Icons Drawable Import
- Scaled Drawable
- Multisource-Drawable
How to Use Material Icons Drawable Import : (Android Studio 1.2)
- Go to File > Setting > Other Settings > Android Drawable Import
- Download Material Icon and select your downloaded path.
- Now right click on project , New > Material Icon Import
- Use your favorite drawable in your project.
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.
GyRo
Former Java developer. Loves technology but keep an open eye that it won't take over humanity
Updated on July 05, 2022Comments
-
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 about 9 yearsI 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 about 9 yearsU have to provide your downloaded icon folder path not your assets folder
-
Kishan Vaghela about 9 yearsU can download Material Icon from github.com/google/material-design-icons/releases and use downloaded folder path
-
Frank about 9 yearsand then what, how do I use this plugin? Right clicking the drawable folder gives me nothing.
-
Kishan Vaghela about 9 yearsRight Click > New > Select your Configured option for this plugin
-
GyRo about 9 yearsEventually 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 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 about 9 years@KishanVaghela thank you so much for the Edit, it is much more clear and easy now.
-
boltup_im_coding almost 9 yearsThe 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 over 8 yearsIt does, I asked him to make this padding optional in the next version.
-
Evgeniy Mishustin over 8 yearsIn Android Studio 1.3 the plugin (as the field Other Settings) doesn't appear under the Settings
-
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 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 ツ about 8 yearsThere is no way to give transparent background in Android Studio 2.0.
-
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 over 7 yearsIn 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 almost 6 yearsThis is the best solution and yet simple. For the icons pack, I generate from makeappicon.com
-
Marwan Salim almost 6 yearsFor the location C:\Users\<your_username>\AndroidStudioProjects\<your_project_name>\app\src\main\res