哪种布局(AbsoluteLayout 等)最适合 Android 中的简单游戏编程?
有以下布局选项可用于创建 Android 界面。
AbsoluteLayout
FrameLayout
LinearLayout
TableLayout
RelativeLayout (and some more)
以下哪项最适合设计简单的游戏?猜测absoluteLayout最简单,但是不同屏幕尺寸会出现问题吗?你有什么建议吗?
There are the following layout options to create interfaces for android.
AbsoluteLayout
FrameLayout
LinearLayout
TableLayout
RelativeLayout (and some more)
Which of the following is most suitable for designing simple games? Guessing that the absoluteLayout is easiest, but will it be problems with different screen sizes? What do you recommend?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 AbsoluteLayout 可以让您最大程度地控制视图的放置位置。不过我建议使用RelativeLayout。这将更加独立于屏幕尺寸和密度。
您可以针对不同的屏幕尺寸或密度使用不同的布局。还要确保不要使用绝对像素 (px) 放置视图,而是使用与设备无关的像素(dp 或 dial)。这些将自动缩放以适应不同的密度。
官方文档中有很多关于这个的内容:
http://developer.android.com/guide/practices/screens_support.html
Using AbsoluteLayout will give you the most control where your views will be placed. However I recommend using RelativeLayout. This will be much more screen size and density independed.
You can use different layouts for different screen sizes or densities. Also make sure not to place your views using abosolute pixels (px), rather use device independet pixels (dp or dip). Those will be automatically scaled for different densities.
There is a lot about this in the official docs:
http://developer.android.com/guide/practices/screens_support.html
我一直在避免使用 AbsoluteLayout,因为它已被弃用: http://developer.android .com/reference/android/widget/AbsoluteLayout.html
I've been avoiding AbsoluteLayout, because it's deprecated: http://developer.android.com/reference/android/widget/AbsoluteLayout.html