针对 Android 高分辨率屏幕进行开发,但支持低分辨率屏幕
我一直在为较低分辨率屏幕 (320x480) 开发 Android 游戏,然后让 Android 处理密度调整,以便游戏在高分辨率屏幕上运行。它允许我保持较小的 APK 文件大小,而且我不必为游戏中的每个图像创建多个版本。它实际上运行得很好,游戏在高分辨率屏幕上看起来仍然不错。
然而,我的问题是,是否可以做同样的事情,只是倒退?我可以针对高分辨率屏幕(800x480)进行开发,然后以某种方式让 android 自动处理密度降低吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的。
在 xml 布局中,使用倾角值作为尺寸。
示例:
100 倾角 =
75@120dpi
100@160dpi
150 @ 240dpi
如果您需要某些可绘制对象的更高分辨率资源,请使用...
可绘制的 hdpi
可绘制 mdpi
drawable-ldpi
该应用程序将根据屏幕的密度使用正确资源文件夹中的可绘制对象。
如果可以使用 FILL_PARENT 或 WRAP_CONTENT,请尽量不要在某些元素上使用绝对宽度和高度。
这里有一些好的建议:
http://developer.android.com/guide/practices/screens_support.html
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
是的,而且工作原理是一样的。您将资源放在适当的目录中,系统将相应地缩小它们的规模。
Yes, and it works the same. You put your resources in the appropriate directory and the system will downscale them accordingly.