Android 2.0 中的分辨率支持
收到我的第一个 Motorola Droid 用户发来的电子邮件。 Android 2.0 中引入的新 480x854 分辨率(而不是 320x480)对我的用户界面造成了严重破坏。一切都变得更小并且位置不佳。
我的印象是,如果我们遵循 XML 布局指南,我们的分辨率是安全的,因为不使用绝对坐标。有人有使 UI 分辨率安全的经验吗?我们需要每个分辨率乘以每个方向的 main.xml 吗?
Received an email from my first Motorola Droid user. The new 480x854 resolution introduced in Android 2.0 (as opposed to 320x480) is wreaking havoc with my user interfaces. Everything is smaller and ill-positioned.
I was under the impression that if we follow the XML layout guides we were resolution-safe, as no absolute coordinates are used. Does anyone have experience in making the UI resolution-safe? Will we need a main.xml for each resolution times each orientation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您使用了哪些尺寸单位?
据我所知,使用
dp
和sp
应该可以保证您的安全。来自文档:
Which dimension units did you use?
AFAIK using
dp
andsp
should keep you safe.From documentation:
eclair 模拟器可以解决这些问题,请务必阅读:
http://developer .android.com/guide/practices/screens_support.html
您的应用程序会根据许多因素(甚至是 min-sdk)响应不同的分辨率。
此外,该页面还提供了一些最佳实践:
The eclair emulator works wonders for these issues, also make sure to read:
http://developer.android.com/guide/practices/screens_support.html
Your application responds to different resolutions based on many factors, even the min-sdk.
Also, from the page, are some best practices:
除了分辨率差异之外,另一件需要考虑的事情是 Droid 的 WVGA 屏幕与 G1 等之前的设备具有不同的纵横比。在我下载的许多旧应用程序中,这表现为屏幕底部的间隙,或纵向模式下垂直未对齐的元素。您可能想要尝试在具有 WVGA 外观的模拟器中运行您的应用程序,以检查您的布局对宽高比所做的任何隐藏假设。
Aside from the resolution difference, the other thing to consider is that the Droid's WVGA screen has a different aspect ratio from previous devices like the G1. In many older apps that I've downloaded, this manifests as a gap at the bottom of the screen, or elements that are vertically misaligned in portrait mode. You may want to try running your app in the emulator with a WVGA skin to check for any hidden assumptions that your layout makes about the aspect ratio.