Android 景观窗口尺寸
我在获取 Android 屏幕尺寸时遇到了麻烦。我不希望状态栏的大小包含在我的尺寸中。我正在开发的应用程序将永久处于横向模式。我一直在用android蜂窝模拟器进行测试。当我使用 中的代码获取尺寸时我可以获得android Honeycomb系统的屏幕宽度和高度吗? 我得到1280x800。我很好奇为什么链接问题中的人减去了状态栏的大小,而我的则不然。另外,我怎样才能真正减去状态栏的大小?如果需要任何其他详细信息,我将定期检查以提供。谢谢!
I have been having trouble getting the screen dimensions for android. I do not want the size of the status bars included in my dimenions. The app that I'm developing is to be permanently in landscape mode. I have been testing with the android honeycomb emulator. When I get the dimensions using the code in How can I get android Honeycomb system's screen width and height? I get 1280x800. I was curious as to why the person in the linked question has the size of the status bars subtracted while mine does not work that way. Also, how can I make it so that the size of the status bars is actually subtracted? If any additional details are needed I will be checking periodically to provide. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的!我终于想通了。我将多个不同来源的代码拼凑在一起,所以我不知道为什么事情会这样进行。这是相关代码。
但有一点需要注意。此代码不会在 onCreate() 方法中工作。相反,将其放入
这应该可以解决获取窗口尺寸的任何问题!
编辑:我相信这个解决方案也应该在纵向模式下工作。不过我还没有测试过。
Okay! I finally figured it out. I pieced together code from several different sources so I don't know exactly why things work out the way they do. Here is the relevant code.
There is one caveat though. This code WILL NOT work in the onCreate() method. Instead, place it in
This should solve any problems with getting window dimensions!
EDIT: I believe this solution should also work in portrait mode as well. I have not tested it though.