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
.
[
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.
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:
- 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.
How to add an image to the drawable folder in Android Studio?
For Android Studio 1.5:
- Right click on res -> new -> Image Asset
- On Asset type choose Action Bar and Tab Icons
- Choose the image path
- Give your image a name in Resource name
- Next->Finish
Update for Android Studio 2.2:
Right click on res -> new -> Image Asset
On Icon Type choose Action Bar and Tab Icons
On Asset type choose Image
On Path choose your image path
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
Android: Integer from Xml Resource
How to Use Android Canvas to Draw a Rectangle with Only Topleft and Topright Corners Round
One Onclickhandler for Multiple Buttons
How to Compile a Static Library Using the Android Ndk
How to Get Add to Home Screen Pop Up on Site Open in Mobile Browser
Android and Setting Alpha for (Image) View Alpha
How to Use Isineditmode() to See Layout with Custom View in the Editor
How to Iterate Through All Keys of Shared Preferences
Menu Items Are Not Showing on Action Bar
Android Broadcastreceiver Within Activity
Ontouchevent Not Working on Child Views
Parcelable Encountered Ioexception Writing Serializable Object Getactivity()
Java.Lang.Unsatisfiedlinkerror: Dalvik.System.Pathclassloader
Android Studio Doesn't Recognize My Device
How to Measure Textview Height Based on Device Width and Font Size