[英]Android handler for different screen sizes
I need to know how my game can handle all these screen sizes i have seen a few options including: 我需要知道我的游戏如何处理所有这些屏幕尺寸我已经看到了一些选项,包括:
Making assets in lots of different sizes 制作大量不同尺寸的资产
I'd like to know which is more efficient ? 我想知道哪个更有效率?
So far i am just making my screen fit to the android device i'm testing on and this could lead to failure in the future if i do not set this handler up 到目前为止,我只是让我的屏幕适合我正在测试的Android设备,如果我不设置此处理程序,这可能导致将来失败
Thanks 谢谢
well if you are using libgdx then you dont have to worry about screen sizes. 好吧,如果你使用libgdx,那么你不必担心屏幕尺寸。 just use its camera class and set its viewports accordingly .
只需使用其相机类并相应地设置其视口。 refer this link for camera
请参阅此链接以获取相机
Also you dont need to make android handlers for it. 你也不需要为它制作android处理程序。
This website talks about how to handle this problem http://developer.android.com/guide/practices/screens_support.html . 本网站讨论如何处理此问题http://developer.android.com/guide/practices/screens_support.html 。
It claims the best practices are: 它声称最佳做法是:
The problem is not with the dimensions of the screen, rather the density of the screens. 问题不在于屏幕的尺寸,而在于屏幕的密度。 Using
dp
to set the size for elements is the most common way. 使用
dp
设置元素的大小是最常用的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.