针对 Android 高分辨率屏幕进行开发,但支持低分辨率屏幕

发布于 2024-09-28 04:21:03 字数 232 浏览 2 评论 0原文

我一直在为较低分辨率屏幕 (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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉墨 2024-10-05 04:21:03

是的。

在 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

电影里的梦 2024-10-05 04:21:03

是的,而且工作原理是一样的。您将资源放在适当的目录中,系统将相应地缩小它们的规模。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文