Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android drawable folder for large screens

I have images in drawable-hdpi(big images) and in drawable-mdpi(small images)

I opened my app on Kindle fire (its get layout from layout-large) and it use images from drawable-mdpi , is any way to let app to get images from drawable-hdpi when screen size is large?

thanks

like image 940
Bera Avatar asked Jul 13 '12 11:07

Bera


2 Answers

I think what you are looking for is to use configuration qualifiers.

It seems you are really misunderstanding what these folders do. Your android will select folder based on it's screen size or pixel-density.

Your Kindle Fire has a medium Pixel density and a large screen. So it selects its resources from the res folders with those given qualifiers.

res/layout-large/my_layout.xml

and images from

res/drawable-mdpi/my_icon.png

You cannot tell your kindle to get images from the hdpi folder because it does not have a high pixel density.

So you could either create a folder called

res/drawable-large-mdpi/ 

specifically for your Kindle Fire device.

Or just make sure the right images are in the right folders.

EDIT: Size qualifiers are deprecated from 3.2.

While deprecated, they still work. Although results may not be what expected (for example: 5" and 7" are seen as same size -large-which still have difference). So they added dp qualifiers to use beyond 3.2. Which are much better. developer.android.com/guide/practices/… It kinda works like media-queries

like image 136
Timmetje Avatar answered Nov 01 '22 19:11

Timmetje


Updating this with the new qualifiers for Android.

Use of size qualifiers such as drawable-large are deprecated in 3.2 or above.

To use the latest method of supporting multiple layouts and densities, you can use the following:

res/drawable-sw600dp-mdpi

In this example, sw600dprepresents the smallest width available to the activity in density-independent pixels,600dpin this case. This is deemed as being a little more fitting for device-specific layouts and drawables as the width is provided instead of a generalized size grouping such aslarge`.

There are also new options for available width and height, full information available here: Supporting Multiple Screens

like image 29
sturrockad Avatar answered Nov 01 '22 20:11

sturrockad