-1

I have been working on few Android apps, but I still don't get the drawable folders. My apps always use only one of the 4 drawables for all sizes in stead of using the appropriate one. For my current project, I created images that I scaled to 92x92, 72x72, 48x48 and 32x32 how can I tell my app to choose from these depending on the device that is used?

Please guide me to any articles or tutorials that u have found helpful. Thanks

ashabasa
  • 311
  • 2
  • 9
  • 20
  • Have you put them in the appropriate folders? – Nathan Walters Jan 01 '14 at 20:27
  • Yes I did,XHDPI, HDPI, MDPI, LDPI. I saw in a YouTube tutorial that they are supposed to load automatically, without further coding. But that's not happening. When I change the size of my screen in eclipse, The icons are always loaded from the same folder ! – ashabasa Jan 01 '14 at 20:33
  • They are in the properly formatted folder names though, such as "drawable-hdpi", correct? And what do you mean by "changing the size of my screen in eclipse"? Are you running on an emulator? – Nathan Walters Jan 01 '14 at 20:35
  • Yes, It's right! Proper sizes in proper folders. No I don't run on an emulator, only on my phone. But when I check the appearance of my xml layout in other screens (There is this drop-down list on eclipse that allows to switch from nexus One whish uses hdpi to nexus 4 which uses xhdpi to other sizes...) and when I select a screen that is suppoed to use a different folder, it doesn't ! – ashabasa Jan 01 '14 at 20:42
  • I just did a test, they properly change depending on device screen resolution for me. How do you know they aren't updating? – Nathan Walters Jan 01 '14 at 20:49

1 Answers1

0

You cannot always trust what Eclipse and an AVD will use for drawables, especially for newer XXHDPI devices. See my post here: Drawable-xxxx : Eclipse Versus AVD.

The folder used by Eclipse (in design view) and what an AVD uses is NOT the same as a real device will use. However, the result will look the same. So, they may choose images in the XHDPI folder, whereas a real device will use the XXHDPI folder, but they try to emulate the display as close as possible. So, what you see in an AVD looks almost the same as a real device. So, an AVD I created to emulate an LG G2 looks very close to what my real LG G2 looks like, even though they are using different folders.

The bottom line is that the way a real device selects what folder to use and the algorithms used to scale it are not the same that our development and testing tools use.

I have only used Eclipse/ADT though. Maybe Android Studio is different?

Community
  • 1
  • 1
Rick Falck
  • 1,778
  • 3
  • 15
  • 19