开发者

How to support for multiple resolutions?

According to http://developer.android.com/guide/practices/screens_support.html "Normal screen" with hdpi can have few resolutions, like 480X800 600x1024 etc. As I understand to support this resolutions i have to put my resources in res/drawable-hdpi, and now I want to have full screen background for my app, so i put some background.png file in res/drawable-hdpi. Let's say we have two devices one with 480x800 resolution, second with 600x1024 resol开发者_如何学Goution, and in folder res/drawable-hdpi I can have only one file background.png with one resolution. How to provide alternate resources for the same screen size and density but different resolutions ??


Just do not provide alternative resources for different resolutions. In most cases background images will be scaled up/down to screen size. If you want more control over this process you can define drawable using XML and define how it should scale according to different conditions. All information can be found in android's documentation All you have to do is define this drawable basing on ordinary .png and put something like "scalable_background.xml into your drawable folder. In my opinion ordinary .png background is good enough in most of cases, but I don't recommend to make different versions for various *dpi. Those files are usually huge so my best option is to generate one file for hdpi and let system scale it down when necessary.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜