Android、蜂窝和 ICS - 报告屏幕尺寸,无需底部按钮
好的,在蜂窝上我有一些确定屏幕尺寸的函数。这有时用于动态执行一些 UI 操作。但问题是它包含带有 Android 按钮的底部栏,这会减少您的可用屏幕尺寸。
android Display
函数可能会返回正确的函数(例如,1280x800 显示器将返回 1280x740 作为显示器,这是不包括底部 android 按钮的显示器),但 webview 中的 javascript 函数将仅确定实际大小,因此 1280x800 得到 1280x800,这是不正确的,因为底部栏在那里。
如何在不进行硬编码的情况下获得底部栏的大小,我至少可以通过这种方式从不正确的屏幕大小整数中减去它。
Okay, on honeycomb I have some functions that determine the screen size. This is sometimes used to dynamically do some UI stuff. But the problem is that it includes the bottom bar with the android buttons, which subtracts from your available screen size.
The android Display
function may be returning the right function (for instance, a 1280x800 display will return 1280x740 as the display, this is the display not including the bottom android buttons) but a javascript function in a webview will only determine that actual size, so 1280x800 gets 1280x800 which is incorrect because the bottom bar is there.
How can I get the size of the bottom bar without hard coding it, I can at least subtract it from incorrect screen size integers this way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是最好的方法,但这是我如何做到这一点(在 Android 2.2 上,但这也应该在 3.x 上工作)
可能不是您正在寻找/希望的答案,但至少它适用于 我。
I'm not sure this is the best way but here is how I do this (on Android 2.2 but this should also work on 3.x)
Probably not the answer you were looking/hoping for but at least it works for me.