确定 Android 中可用屏幕尺寸的正确方法是什么
我知道这个问题已经被问过几次了,但我还没有找到满意的答案。如果您想要总屏幕分辨率,则所有先前的答案都有效,但当您想要纠正蜂窝中的通知栏和/或系统栏时,所有先前的答案都无效。
有没有办法确定可用屏幕的尺寸?
I know this question has been asked a few other times but I have yet to find a satisfactory answer. All previous answers work if you want the total screen resolution but fail to when you want to correct for the notification bar and/or the system bar in honeycomb.
Is there a way to determine the dimensions of the usable screen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我之前所做的几乎肯定不是最佳方式:创建一个设置为填充屏幕的控件,然后检查其大小。如果您有在游戏或类似内容中绘制的视图,这会很有用。
What I've done previously is almost definitely not the best way: make a control that is set to fill the screen and then check its size. This is useful if you have a view you paint to in a game or something like that.