Xi Wei
Xi Wei

Reputation: 1679

How add images of different size to Android Studio easily?

I got the following images from design and I would like to add them to my Android Studio project. They are the same image for different sizes.

enter image description here

I remember I was able to drag and drop them into the file directory in AS and they will fall into the right folders. However, it's now saying these folder already existing and I cannot drag and drop them.

My question: is there an easy way to import these images besides drag and drop each one individually?

Upvotes: 1

Views: 2538

Answers (3)

Xi Wei
Xi Wei

Reputation: 1679

OK, I learned I need to do copy/paste instead of drag/drop.

  1. select all the drawable-hdpi, drawable-mdip folders and do cmd + c
  2. select the res folder in AS and do cmd + v

The images will fall into the correct location.

Upvotes: 0

user16515551
user16515551

Reputation:

I understand your question and I will answer, but let us go a little deeper into this rationale. You need to create images for screens with different sizes.

1 . SVG file :

I suggest you use images in SVG format. They can work well on all screens.

File > New > Vector asset

2 . Use plugin ( Material Design Icon Generator ) :

This plugin help you to set material icon in your app resources. Its also generate vector icons that work well on all screens . Here is page of this plugin :

https://plugins.jetbrains.com/plugin/14170-material-design-icon-generator

3 . Copy & Paste :

Move your images to the following folders (create them if they do not exist):

src/main/res/drawable
src/main/res/drawable-hdpi
src/main/res/drawable-mdpi
src/main/res/drawable-xhdpi
src/main/res/drawable-xxhdpi
src/main/res/drawable-xxxhdpi

Upvotes: 2

Aswanth Rusoe DS
Aswanth Rusoe DS

Reputation: 33

Ok then You may try this Copy the image from your local folder and right-click on the folder of the AS project you want to add the image and select paste.

You can change the size at first you create that image.

Upvotes: 1

Related Questions