Drawable folder different screen resolution issues

[亡魂溺海] 提交于 2019-12-11 08:58:03

问题


I am having the following specification images,

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp

Both in portrait and landscape. These are stretched in Tablet. But working fine in mobile. I am handling the configuration changes using the onConfigurationChanged() override method. Is any other way for giving the images for Android application. I reffered the following link for screen sizes. http://developer.android.com/guide/practices/screens_support.html


回答1:


you can use drawable-large for tab




回答2:


Following crocboy link is correct, and i suggest you to try including more buckets on your app. For example, in my applications i use also this:

drawable-sw600dp-mdpi
drawable-sw720dp-mdpi

In this buckets, put images that match tablets screen, for example in drawable-sw600dp-mdpi insert a background with this size 1280x800 and for drawable-sw720dp-mdpi a background with this size 1920x1200.

It's quite difficult to decide wich tablet to target, because we have different screen size.

EDIT

"application have to support all devices. So, the drawable folder images also have to support for all the devices. How to achieve this?". Basically Android create this 4 folder for drawable:

drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi

(To be picky, low drawable-ldpi is not quite used, because small device are loosing appeal)But due to density and screen size you can have:

drawable-large-mdpi
drawable-large-hdpi
drawable-large-xhpdi
drawable-xlarge-hdpi
drawable-xlarge-mdpi

And so on with various combination! If you are looking for image perfection (like my graphics collegue, wich is an iOS psychopath) you have to create images for every type of screen, and put it on relative drawable bucket.




回答3:


In the same link ("How to Support Multiple Screens"), they tell you how to create seperate drawable folders for each resolution - such as drawable-hdpi. When the system detects a high-resolution screen, it takes drawables from the high-density folders. You can also do the same with layout folders. If it's a low-resolution screen, it uses only images from the low-resolution images folder, drawable-ldpi. Here is also a good article article about how Android picks images from these folders.



来源:https://stackoverflow.com/questions/17994018/drawable-folder-different-screen-resolution-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!