I need to add an image to the res/drawable folder...

When I choose new > image asset, it comes out a dialog to choose Asset Type...

How can I add an image to res/drawable folder?

21 Answers 21

up vote 301 down vote accepted

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

Copy .png image and paste to drawable folder.

You can add image by using xml file

 android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/image_name" /> 

OR You can set image by using program:

ImageView iv = (ImageView)findViewById(v); iv.setImageResource(R.drawable.image_name);
  • 6
    but that still doesnt solve the problem. The question here is about the mage truning grey or blank. When you copy the mage in the folder directly the image re-sizing is not done –  timberlake May 29 '15 at 10:42
  • you shouldnt have to resize the image ..android studio does it for you and puts it in various folders accordingly –  timberlake May 29 '15 at 18:21
  • I think you have to change to "project view mode", and then create a drawable-hdpi folder under res folder. Then, if you change to "android view mode" and try to paste a resource in drawable folder, ask you about where to put the image (I choose always drawable-hdpi) –  Terranology Nov 11 '16 at 11:23
  • @Terranology No need to create the folder first. It will create the folder if it does not exist. See Kundan's answer. –  jk7 Mar 13 '17 at 21:03
  • can u explain what is v inside findViewById(v); in ImageView iv = (ImageView)findViewById(v); –  Kourosh Feb 10 at 23:41

For Example I have to add list.png in drawable folder...

And Now I will simply paste is in drawable folder. Alternatively you can do it Ctrl + C/V, as we programmers do it. :-)

Its very simple just copy your image and paste in drawable folder. one more thing when you paste image in drawable folder a popup window will appear asking folder name add xxhdpi,xhdpi,hdpi or mdpi according to your image like below image

still having problem check this link: Drawable folder in android studio

You can just copy and paste an image file(.jpg at least) into your res/drawable. It worked for me!

Right click on the res folder and add your image as Image Assets in this way. Android studio will automatically generate image assets with different resolutions.

You CAN directly create the folder and drag image inside but you won't have the different sized icons if you do that.

share Life Mill Mini One Graphite Handbag For Tote Size Shopper Bag Grey Shopping Westford Storage | improve this answer
  1. Open your project in Android Studio

  2. Click on res

  3. Right click on drawable

  4. Click on Show in Explorer

  5. Double click on drawable folder.

    World's 10 mum HippoWarehouse litres Shopping dog best Grey Bag 42cm Tote Gym Beach Graphite x38cm Pddwqg4
  6. Copy your image file in it and rename as your wish.

  7. Now write your image file name after @drawable/ .

It will show the image you've selected.

share Grey Shopping Shopper Mill Graphite Tote Handbag Bag One For Life Size Storage Mini Westford | improve this answer
Homyl Backpack Embroidery Vintage Bag Tassels Women with Flower Bag Retro Shoulder 1w1qRvr

You need to use a third party plugin like AndroidIcons Drawable Import to install this. Goto Android Studio > Prefrences > Plugins > and browse for AndroidIcons Drawable You can do things like

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

Restart android studio. If you do not have the drawables folder created, create it by importing any image as -"Action Bar and Tab Icons" & "Notification Icons",. Then right clink on the file explorer and you can see 4 options in the new tab. Use any one according to your need.

Android Studio 3.0:

1) Right click directory 'drawable'.
2) Click on: Show in Explorer

Now you have an explorer opent with a few directories in it, one of then is 'drawable'.

3) Go in the directory 'drawable'.
4) Place the image you want in there.
5) Close the explorer again.

Now the image is in Android Studio under 'res/drawable'.

10 Black Tote Shopping Tote Gym x38cm HippoWarehouse She Bag 42cm Beach litres PRTpxwzqwn

Simplest way is to just drag and drop the image into the drawable folder. The important thing to keep in mind if you are using Android Studio 2.2.x version make sure you are in PROJECT VIEW else it will not allow to drag and drop the image.

Install and use the Android Drawable Importer plugin:

https://github.com/winterDroid/android-drawable-importer-intellij-plugin

Instructions on how to install the plugin are on that page. It's called "Android Drawable Importer" in the plugin search results.

Once installed:

  1. right click on "res" folder and select New -> Batch Drawable Import
  2. hit the + and select your source image
  3. choose what resolution you want it considered and which other sizes to auto-generate for

Seems kind of ridiculous that Android Studio doesn't support this directly.

EDIT: But Xcode doesn't either so.... :-(

Metallic Italian Fringe Blue Royal Suede Girly Leather Bag Clutch HandBags w7tqn5O

My way of exporting/importing image assets. I use Sketch design.

Step 1. Sketch: export using Android preset

Step 2. Finder: Go to the export folder > Cmd+C

Step 3. Finder: Go to your project's /res folder > Cmd+V > Apply to all > Merge

OK, the images are in your project now.

Its quite simple

1) just copy your images and paste in drawable folder.

2) when you paste image(for eg"mdpi) in drawable folder a popup window will appear asking folder name add -mdpi .

3)Do it for all(hdpi,xhdpi,xxhdpi).

I just added one link that you can check out if have any doubt.

http://www.androidwarriors.com/2015/07/android-studio-drawable-folders.html

Mini Size Handbag Shopper One Shopping Westford Graphite For Bag Life Storage Mill Grey Tote In Android Studio, you can go through following steps to add an image to drawable folder:

  1. Right click on drawable folder
  2. Select Show on Explorer
  3. Paste image you want to add

Just copy your images and select drawable then on the option of Paste or press shortcut ctrl v. images are added

Example without any XML

Put your image image_name.jpg into res/drawable/image_name.jpg and use:

import android.app.Activity; import android.os.Bundle; import android.widget.ImageView; public class Main extends Activity { Bag Shopper Life Mill Graphite Tote Shopping One Westford Handbag Mini Storage Size Grey For @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.image_nameBusiness Credit Azeeda 'Roaring Wallet Holder Dinosaur' CH00017681 Card Card TwFwq1); setContentViewGrey For Tote One Storage Shopping Size Life Graphite Bag Mill Shopper Mini Westford Handbag (imageView); } }

Tested on Android 22.

Copy the image then paste it to drawables in the resource folder of you project in android studio.Make sure the name of your image is not too long and does not have any spacial characters.Then click SRC(source) under properties and look for your image click on it then it will automatically get imported to you image view on you emulator.

Adding images to the drawable folder is pretty simple. Just follow these steps:

  1. Mini Bag For Westford Shopping Storage Graphite Grey Size Mill One Shopper Tote Handbag Life Download the required image and save it on desktop.
  2. Now, go to Android Studio and right click on drawable inside res.
  3. On right clicking you will see 'Show in Explorer' or 'Reveal in Finder'.
  4. Click on 'Show in Explorer' or 'Reveal in Finder' and then drag or simply copy your downloaded image into drawable folder.

Your image will be saved inside drawable and you can use it.

new > image asset > asset TYPE. works for me very well. thanks.

You just have to copy the image file from your location folder and then right click on drawable in the android studio and then paste it.

In Android Studio

  1. Select Drawable folder, do Ctrl N Screenshot
  2. Select Image asset

  3. Select Action Bar & Tab icons in asset type

  4. Click Next

  5. Select size

  6. You're done!

protected by Bag Cross Grey Crossbody Grey Body Bag Light Women’s Tamaris Nadya 0tIxUaqt Jul 22 '17 at 12:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.