Open In App

How to Add Image to Drawable Folder in Android Studio?

Last Updated : 18 Feb, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The resource folder is the most important folder because it contains all the non-code sources like images, XML layouts, UI strings for the android application. In Android Studio inside the res folder, one can find the drawable folder, layout folder, mipmap folder, values folder, etc. Among them, the drawable folder contains the different types of images used for the development of the application. We need to add all the images to the drawable folder for the application development. Images are used in android applications to provide more user-friendly behavior & functionality. So in this article, we are going to discuss how to add an image to the drawable folder with multiple methods being explained step by step.

Method 1

In method 1 we will do it through the way Android Studio provided to you.

Step 1: Open Android Studio and go to the app > res > right-click > New > Image Asset as shown in the below figure.

Step 2: A pop-up screen will arise like below. Here choose Action Bar and Tab Icons in Icon Type.

Step 3: Then choose Asset Type as Image and enter the Path of your image. Enter the name of your image and click on Next.  

Step 4: Now you can see the android studio automatically created the different-sized images. You can directly create the folder and drag image inside but you won’t have the different-sized icons if you do that and this the main advantage of following this method. And finally, click on the Finish button.

Now go to the app > res > drawable and you can find a folder named as image and the different sized images inside this folder as shown in the below image.

Note: 

  • drawable-ldpi (low-density): Lower images quality supported by the earlier sets of the android – 240×320 pixels
  • drawable-mdpi (medium-density): For medium images support – 320×480 pixels
  • drawable-hdpi (high-density): Images for the Android Broad Screen set or Android Phones with the Higher resolution – 480×800 pixels
  • drawable-xhdpi (extra high-density): Devices with maximum resolution – 720×1280 pixels

Method 2

Method 2 is very easy but as we discussed above we can directly create the folder and drag image inside but you won’t have the different-sized icons if you do that and this the main advantage of method 1. So the developer must follow method 1. Below is the step by step implementation of method 2:

Step 1: In this method first of all in your system find your required images and copy the image as we do normally.

Step 2: Then open the Android Studio go to the app > res > drawable > right-click > Paste as shown in the below figure.

Step 3: Then a pop-up screen will arise like below. Here choose your directory where you want to store your image file. And click on OK.

Step 4: In this screen, you can rename your image file name and also choose your directory. And click on the Refactor button. And you are done.

Now go to the app > res > drawable and you can find a file named as method_2.jpg as shown in the below image.


Similar Reads

How to Convert SVG, PSD Images to Vector Drawable File in Android Studio?
In order to use the SVG (Scalable Vector Graphics) or PSD (Photoshop document) image file in your android studio project, you have to first convert them into an XML (Vector Drawable) file. Why XML (Vector Drawable) file? small in sizescalability (It scaled without loss of display quality)height and width can be changed easilysupport transparencycol
3 min read
How to Create Drawable Resource XML File in Android Studio?
Prerequisite: Android Project folder Structure A drawable resource is a common concept for a graphic that can be drawn to the screen and which one can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon. There are several different types of drawable resources files a
3 min read
How to Add Text Drawable to ImageView in Android?
In many android apps, you will get to see a feature in which you can see a simple text is displayed inside an ImageView or you can get to see that a text is displayed in a specific image or a shape. Mostly this type of view is seen in the Contacts application which is present on your Android device. In that app, you will get to see the first letter
5 min read
How to Display a Drawable Inside a Button in Android?
A Button in Android is basically a subclass of TextView, which lets the user press or click it to perform an action. Buttons generally contain text that lets the user understand the action property of the button. Sometimes, an ImageView can also be used as a button if the developer wishes to display an image rather than some text. But some buttons
3 min read
How to Convert Drawable to Bitmap in Android using Jetpack Compose?
A drawable is an image file that is used to display inside our image view. We can display the images directly within the image view from our drawable folder. Images can be displayed within our image view directly in the form of the image file or a bitmap format. In this article, we will take a look at How to Convert Drawable to Bitmap in Android us
7 min read
How to Set Background Drawable Programmatically in Android?
In many android applications, we can get to see that the background color of this application changes dynamically when updated from the server. For updating this color we have to set the background color of our layout programmatically. In this article, we will take a look at How to Set Background Drawable Programmatically in an Android application.
3 min read
How to fix "Android Studio doesn't see device" in Android Studio?
In Android Studio, sometimes the list of devices and emulators doesn't list your physical device when you try to plug it in. Or you may have faced a situation when you plugged the phone in for the first time, no dialog appeared asking if you trust the computer. But the laptop is already allowed to connect to the mobile device. However, the button R
4 min read
How to Fix "Android studio logcat nothing to show" in Android Studio?
Logcat Window is the place where various messages can be printed when an application runs. Suppose, you are running your application and the program crashes, unfortunately. Then, Logcat Window is going to help you to debug the output by collecting and viewing all the messages that your emulator throws. So, this is a very useful component for the ap
2 min read
Assets Folder in Android Studio
It can be noticed that unlike Eclipse ADT (App Development Tools), Android Studio doesn’t contain an Assets folder in which we usually use to keep the web files like HTML. Assets provide a way to add arbitrary files like text, XML, HTML, fonts, music, and video in the application. If one tries to add these files as "resources", Android will treat t
4 min read
How to Create Anim Folder & Animation File in Android Studio?
The animation is a method in which a collection of images is combined in a specific way and processed then they appear as moving images. Building animations make on-screen objects seem to be alive. To apply Animations to the Application sometimes we need to make an anim folder in Android Studio to store the animation file under the resource folder
2 min read
Article Tags :