1

I am new to android studio. Can any one tell me what is the best way to add images as in eclipse? We have different folder like mdpi, xdpi .. Can any one tell me what is the best way to add images and size also?

 I am trying with new->image asset but is this right way? what should be image size 

.. as in eclipse we are adding directly to res->mdpi,xdpi

What size should i take? What is asset type in that tool it giving only 3 option ie icon, action and tab, notification which one to be take?

Vanarajan
  • 973
  • 1
  • 10
  • 35
andro
  • 1,007
  • 1
  • 14
  • 32

2 Answers2

5

Just copy the image:

enter image description here

and paste it into drawable:

enter image description here

You can also drag and drop.

Now, for different sizes, just make a folder with the appropriate names. Go into project view first:

enter image description here

Then, see these little folders in the res?

enter image description here

Place each image into each folder. Here are the different size directories:

drawable-mdpi for medium-density

drawable-hdpi for high-density

drawable-xhdpi for extra-high-density

drawable-xxhdpi for extra-extra-high-density

Thats it.

If this helped, make sure to accept it by pushing the checkmark. If you have more questions, feel free to ask, I am happy to help!

Edit to question:

320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).  
480dp: a tweener tablet like the Streak (480x800 mdpi).  
600dp: a 7” tablet (600x1024 mdpi).  
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Ruchir Baronia
  • 7,406
  • 5
  • 48
  • 83
  • hi can give image size like mdpi shld have480*680 – andro Dec 16 '15 at 07:08
  • @andro Sure! `320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc). 480dp: a tweener tablet like the Streak (480x800 mdpi). 600dp: a 7” tablet (600x1024 mdpi). 720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).` – Ruchir Baronia Dec 16 '15 at 07:10
  • i am using 1850*1370 still it showing some space to right and left side – andro Dec 16 '15 at 11:01
  • @andro This happens quite often. It means your image is listed in the `src` attribute. Instead, put it in the `background` attribute. :) – Ruchir Baronia Dec 16 '15 at 11:09
  • @andro Another thing you can do is follow my edit, and put it into the appropriate directories through re-sizing. This will show you [how](http://stackoverflow.com/questions/14747489/android-handling-images-size-for-multiple-screens). If I helped, make sure to accept my answer! – Ruchir Baronia Dec 16 '15 at 11:12
  • background done the trick , may i know what ratio shuld i follow – andro Dec 16 '15 at 11:17
  • @andro What do you mean by ratio? The size you want to display depends on...well...what you want to display, so, just change the height and width to a `dp` size that fits your needs! :) – Ruchir Baronia Dec 16 '15 at 11:22
  • say i want to display full screen image then what would be size ? h * w ? – andro Dec 16 '15 at 11:26
  • both , want to support all most all device – andro Dec 16 '15 at 11:39
  • @andro Very long process... Make 8 more xml layouts per layout...Then, change each layout based on size...So, you'll be better off just getting the size of the screen through java (just seach up how to get screen size in android) and then setting the size of your image to that size. – Ruchir Baronia Dec 16 '15 at 11:42
  • r u kidding me 8 xml ? i think by putting 4 drwable will do – andro Dec 16 '15 at 12:01
  • @RuchirBaronia hi, copying via shortcuts is working fine. But when I drag and drop into the folder, for a single image, it shows a move dialog but the 'Ok' button is unresponsive!! And the whole application seems stuck and after some time typing enter key, it shows a dialog for refactor for that image. Is this a new bug? I'm surprised the drag and drop is having issues! I'm on OS X 10.10 and Android Studio 1.5.1 – apostleofzion Feb 25 '16 at 07:32
0

You can directly Add your images in drawable folder OR If you have requirement for multi size images then use drawable size categories like.

drawable-mdpi for medium-density

drawable-hdpi for high-density

drawable-xhdpi for extra-high-density

drawable-xxhdpi for extra-extra-high-density

It can be found in detail Here

ajinkya gaurkar
  • 197
  • 1
  • 14