Delveloping for Android high res screens, but supporting low res screens

不打扰是莪最后的温柔 提交于 2019-12-24 06:34:08

问题


I've been developing Android games for the lower res screens (320x480) and then letting Android handle the density adjustments so the games work on high res screens. It allows me to keep the size of my APK files small and I don't have to create multiple versions of every image in my games. It actually works fine, the games still look nice on higher res screens.

However, my question is, is it possible to do the same thing, only backwards? Can I develop for high res screens (800x480) and then somehow let android handle the density reductions automatically?


回答1:


Yes.

In your xml layouts, use dip values for sizes.

Example:

100dip = 75 @ 120dpi 100 @ 160dpi 150 @ 240dpi

if you need a higher res resource for certain drawables, use the... drawable-hdpi drawable-mdpi drawable-ldpi

The app will use the drawable from the correct resource folder depending on the screen's density.

Try not to use absolute widths and heights on certain elements if you can use FILL_PARENT or WRAP_CONTENT.

Here's some good tips: http://developer.android.com/guide/practices/screens_support.html




回答2:


Yes, and it works the same. You put your resources in the appropriate directory and the system will downscale them accordingly.



来源:https://stackoverflow.com/questions/3979981/delveloping-for-android-high-res-screens-but-supporting-low-res-screens

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