我目前正在开发我的应用程序,以便与 Galaxy Note 2 和即将推出的 Galaxy S3 引入的三星多窗口功能兼容。如果你不知道我在说什么:
(来源:androidheadlines.com)
如果您有兴趣,可以通过以下链接了解如何操作: here
我的问题是我需要知道我的应用程序使用的高度/宽度。 我正在这样做:
displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
heightScreen = displaymetrics.heightPixels;
widthScreen = displaymetrics.widthPixels;
但这会返回整个屏幕的大小,而不仅仅是我的应用程序使用的部分。我的 Activity 仅由占据整个空间的面板组成,但 panel.getHeight() 或 getWidth() 返回 0。
如何获得真实的高度/宽度?
提前致谢。
最佳答案
My activity is only compose by a Panel which take the entire space, but the panel.getHeight() or getWidth() return 0.
稍后尝试检查。您可能正在 onCreate()
中检查这个,据我所知这太早了。
关于android - 三星的多窗口支持 - 屏幕尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13441758/