开发者

Drawables for qHD resolution

开发者 https://www.devze.com 2023-03-15 09:44 出处:网络
I\'m designing a game possibly for all kinds of Android devices, so I have multiple drawable folders for phones of different resolutions, and for tablets. Here is the list of my folders:

I'm designing a game possibly for all kinds of Android devices, so I have multiple drawable folders for phones of different resolutions, and for tablets. Here is the list of my folders:

  • drawable-mdpi - for 480x320 devices
  • drawable-hdpi - for 800x480 and 854x480 devices
  • drawable开发者_JAVA百科-large-hdpi - for 1024x600 tablets
  • drawable-xlarge-mdpi - for 1200x800 tablets

My question is what name should have a folder with drawables for qHD resolution, which is 960x540 and 256 dpi? Thanks in advance.


I will deeply, strongly, emphatically encourage you not to use "-large" or "-xlarge" qualifiers with drawables. If you are doing this, you are almost certainly not doing what you think you are.

For example.

"drawable-large-hdpi" does not mean "1024x600 tablets." It means an hdpi screen that is classified as large. There are a huge number of screen sizes that fit in this category. In fact you will soon be seeing 1024x600 mdpi tablets.

And "drawable-xlarge-mdpi" does not mean "1200x800 tablets." First of all, tablets like the Xoom are actually 1280x800. And other possible resolutions here are 1280x720, 960x720, 1920x1200, and on and on and on.

If you are doing this kind of thing, let me suggest: just write some code instead. If you have a set of drawables that you want to pick to best match the space you have available in your UI, write some code that looks at the space it has available and picks a drawable. And when you do this, don't use Display.getDisplayMetrics(). Implement this based on the space actually given to your appropriate view in the view hierarchy.

Now all that said, qHD screens are generally hdpi normal size.

So, another example: "drawable-hdpi" doesn't have anything to do with a resolution at all. Possible resolutions you will see here: 800x480, 640x480, 960x540, and on and on. \

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号