屏幕尺寸和布局
我目前陷入理解文档可能存在的问题。
我一直在阅读有关支持多个屏幕的文档,并且我有一些特别是 HTC Desire 和 HTC Legend。
据我了解,通过查看开发人员文档中的屏幕矩阵,Legend 是一个“普通”屏幕,而 Desire 是一个大屏幕。
添加布局目录layout/、layout-small/和layout-large解决了我使用小屏幕设备的问题。但现在,当试图让应用程序在 Desire 和 Legend 中看起来都不错时,它们似乎都使用正常的屏幕布局。
有任何提示、解决方案或解释吗?
I'm currently stuck at what might be a problem with understanding the docs.
I've been reading the docs about supporting multiple screens and I'm having some issues specifically with layoyt differences between the HTC Desire and the HTC Legend.
From my understanding, by looking at the screen matrix in the developer docs, the Legend is a 'normal' screen and the Desire is a large screen.
Adding layout directories layout/, layout-small/ and layout-large solved my problems with small screen devices. But now, when trying to make the app look good in both the Desire and the Legend, it seems like they both use the normal screen layout.
Any hints, solutions or explanations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
HTC Desire - 其屏幕为 480x800 WVGA800 - 被视为普通 screen-hdpi,而 HTC Legend - 其屏幕为 320 X 480 HVGA - 被视为普通 screen-mdpi(参见表 1 此处)。因此,两种设备都使用正常的屏幕布局和 mdpi 图形,但由于 Desire 具有 hdpi 屏幕,Android 会放大图形(通常结果是它们看起来模糊)。为了使布局在 Desire 上看起来不错,您应该提供 hdpi 图形并将它们放在名为 drawable-hdpi 的文件夹中。
HTC Desire - whose screen is 480x800 WVGA800 - is considered to be normal screen-hdpi, while HTC Legend - whose screen is 320 X 480 HVGA - is considered to be normal screen-mdpi (look at Table 1 here). So the normal screen layout and mdpi graphics are used for both devices, but since the Desire has a hdpi screen, Android scales up the graphic (generally the result is that they look blurry). In order for the layout to look good on the Desire you should provide hdpi graphics and put them in a folder named drawable-hdpi.
在布局中,我使用布局权重来指定尺寸。这将在很大程度上帮助在各种屏幕设备上运行应用程序。
在这里检查布局权重,
http://mobiforge.com/designing/story/understanding -user-interface-android-part-1-layouts
In layouts I use layout weights to specify the dimensions. That will help to large extent when running app in various screen devices.
Check about layout_weights here,
http://mobiforge.com/designing/story/understanding-user-interface-android-part-1-layouts
尝试在正常布局中使用wrap_content、fill_parent或dp单位。
无论如何,创建多个布局是一个乏味但也许更好的选择。
在清单中设置此值
并获取正在使用的屏幕大小
一旦您获得了屏幕的大小,我想您知道如何为其分配某个预定义的(由您)布局。
我希望这对您有所帮助,如果您仍然有任何问题,请在下面评论,我们将看到如何解决它!
Try to use wrap_content, fill_parent, or the dp unit in your normal layout.
Anyway creating several layouts as you are doing is a tedious but maybe better option.
Set this in your manifest
and get the size of the screen in use with
Once you have the size of the screen I think you know how to assign it a certain predefined (by you) layout.
I hope this helps, if you still have any prob, comment below and we'll see how to solve it!