The Wayback Machine - https://web.archive.org/web/20240712115558/https://www.geeksforgeeks.org/how-to-add-different-resolution-images-in-android-studio/
Open In App

How to Add Different Resolution Images in Android Studio?

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

Android supports a broad range of devices and if one wants to create an application in android then the application must be compatible with the different mobile devices. For supporting the different screen sizes one must have different size images that will save in multiple folders. Normally Android has four folders that cover almost every device:

  • 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

So in Android studio, it is necessary to create different folders for adding different resolution images. Please follow the following steps:

Step by Step Implementation

Step 1: So before adding different resolution images to the android studio one must have different resolution images. So please refer to the Simple nine-patch generator to create different resolution images or one can use high-end editor tools like Adobe Photoshop.

Step 2: Open the Android Studio and open the project in Android mode as shown in the below image.

Step 3: Now go to the app > res > New > Directory as shown in the below image.

Step 4: After clicking on the Directory a screen will be popped up like below. Now enter the New Directory name and press enter. Now the new directory drawable-Idpi has been created.

Step 5: To locate the drawable-Idpi directory first of all switch to Project mode then Your Project Name > app > src > main > res > drawable-Idpi and you can find your created directory. Similarly one can create the rest of the folder “drawable-mdpi”, ”drawable-hdpi” and “drawable-xhdpi”.

Step 6: Just go to drawable-Idpi > right-click > Paste and paste the different resolution images inside respective different folders.

Note: While pasting images to different resolution folders, keep one thing in mind all the images should have a common name. For example: inside drawable-hdpi >image.png then drawable-xhdpi >image.png. That means the name of the images is the same but every image has a different resolution. So in this way you just have to write android:background:@drawable/image and android will automatically adjust the image as per the different mobile resolutions.


Previous Article
Next Article

Similar Reads

Batch Import Images for Different Screen Resolution in Android Studio
While Developing an App, we require many images as an icon in our app. Here we are going to explain how Import Images for Different Screen resolutions in Android Studio using Batch Drawable. For Android, you need to create these graphics that have to be compatible and supporting all devices. Step By Step Implementation Step 1: First click on File
1 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
Different Ways to Change or Add Themes to Android Studio
When we are working on any editor or IDE we get used to it and its environment like if we are using Sublime then we like its dark background environment. We have now moved to Android studio but we are not comfortable with the default background and theme. Now the point that comes here is how we can Change or Add Themes to Android Studio. So in this
3 min read
Different Ways to Add Stacktrace or debug Option when Building Android Studio Project
While developing your favorite app, you might at some point of time arrived upon this strange error, :GfGapp:processDebugResources FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to
2 min read
Different Ways to Change Android SDK Path in Android Studio
Android SDK is one of the most useful components which is required to develop Android Applications. Android SDK is also referred to as the Android Software Development Kit which provides so many features which are required in Android which are given below: A sample source code.An Emulator.Debugger.Required set of libraries.Required APIs for Android
5 min read
Different Ways to Fix “Select Android SDK” Error in Android Studio
Android SDK is one of the most useful components which is required to develop Android Applications. Android SDK is also referred to as the Android Software Development Kit which provides so many features which are required in Android which are given below: A sample source code.An Emulator.Debugger.Required set of libraries.Required APIs for Android
5 min read
Different Ways to Analyze APK Size of an Android App in Android Studio
APK size is one of the most important when we are uploading our app to Google Play. APK size must be considered to be as small as possible so users can visit our app and download our app without wasting so much data. In this article, we will take a look at How we can analyze our APK in Android Studio to check the APK size. Android Studio itself pro
3 min read
Different Ways to fix "Error running android: Gradle project sync failed" in Android Studio
Gradle is one of the most important components of Android apps. It handles all the backend tasks and manages all the external dependencies which we will be going to use in building our Android Application. Sometimes due to any issue or after formatting of your pc. Some of the Gradle files may get deleted unexpectedly. So when you will start buildin
3 min read
How to Add OpenCV library into Android Application using Android Studio?
OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. When it integrated with various libraries,
3 min read
Article Tags :