Android - 不同屏幕分辨率的奇怪行为
我在 Android 中遇到屏幕分辨率问题。
当我第一次在 VGA AVD 上运行我的应用程序时,我发现了这个问题,并且应用程序的图像没有占据我期望的屏幕百分比。我尝试在 HVGA 和 QVGA 上运行它,发现它们都占据了完全相同的屏幕百分比,就好像屏幕分辨率相同一样。
事实上,分辨率是相同的:我调试了程序并在调用 onSizeChanged 时检查了宽度和高度,并为所有 AVD 获得了相同的值(320 x 430,或对于宽分辨率为 320 x 483)。我创建了一些 AVD 并手动设置了它们的分辨率,但行为没有改变。
我的活动的内容视图给了我这些错误的解决方案,它是一个继承自 View 的类。
I'm having some problem with screen resolutions in Android.
I found the problem when I first ran my application on a VGA AVD and the application's images did not occupy the % of the screen I was expecting them to. I tried to run it on HVGA and QVGA and found out that they all occupied the exact same % of the screen, as if the screen resolution was the same.
In fact, resolution was the same: I debugged my program and checked the width and height when onSizeChanged was called, and got the same values for all the AVDs (320 x 430, or 320 x 483 for wide resolutions). I created some AVDs and manually set their resolution, but the behavior did not change.
My activity's content view, that is giving me these wrong resolutions, is a class which inherits from View.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了同样的问题,在 AndroidManifest.xml 中添加“minSdkVersion”解决了它。
I had the same problem, adding a "minSdkVersion" to my AndroidManifest.xml solved it.