Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio. Drawables folder and sizes?

I'm an Eclipse developer and recently switched to Android Studio.

I know that "drawable" folder is where I must upload all the images I'm going to use in my Android project but, what happens with the image sizes? In Eclipse there are different folders for each size (xxhdpi, xhdpi, hdpi...)

What method should I use now to get the best compatibility with images and devices?

Thanks.

like image 319
ProtectedVoid Avatar asked Mar 22 '15 23:03

ProtectedVoid


People also ask

What folder is Drawables directory in?

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.

Why are there different drawable folders?

1) The reason behind the different drawable folders - to enhance user experience when using our app, by accomodating each device's screen density. 2) "Where should I store ..." - ideally, you store an image with the appropriate size for each screen density that exist.

What is the preferred image format for the Drawables?

Supported file types are PNG (preferred), JPG (acceptable), and GIF (discouraged).

What is drawable folder in Android Studio?

A drawable resource is a general concept for a graphic that can be drawn to the screen and which you 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 drawables: Bitmap File.


1 Answers

In Eclipse there are different folders for each size (xxhdpi, xhdpi, hdpi...)

They are there in Android Studio too. The Android Tools team kinda hid them.

If you look just above the project explorer tree thingy on the left, you should see a drop-down, one that probably says "Android" right now:

Android Studio, Android Project View

That is the Android project view, one that gives you a somewhat synthetic look at your project, collapsing things like resource sets and sourcesets to hide those details.

Eclipse users will probably be happier with the classic project view, which you get by clicking that drop-down and switching it to "Project":

Android Studio, Classic Project View

This works much like Eclipse's Package Explorer, where you get an actual filesystem view of what's going on, complete with resource set directories.

It's all the same stuff on the filesystem, but the Android project view masks it a bit.

like image 160
CommonsWare Avatar answered Nov 07 '22 12:11

CommonsWare