简体   繁体   中英

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

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

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, sw600dp represents the smallest width available to the activity in density-independent pixels, 600dp in 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 as in 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 as large`.

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

All qualifiers are processed in the order they appear in Table2 .

Read How Android Finds the Best-matching Resource .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM