Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build an Interactive Story App (Retired) User Input Introducing ImageViews

Different Densities

Hello.

I have android studio 2.2 and all those different densities in my res folder but how i can display image in layout with those different densities?

in android studio 2.2 has different way please help!

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

There is no need to specify the density of the image at all. If you have the different densities correctly added to res it will automatically choose the best density for the device it's displayed on. (all the drawable-*dpi folders alongside drawable in file explorer or Project>Project view, in Project>Android it will show (x) variations of each drawable) You just need to refer to it by the base drawable name ("@drawable/name" or R.drawable.name)

Oh ok thank you very much!