三星的多窗口支持 - 屏幕尺寸 [英] Samsung's multi window support - Screen size

查看:197
本文介绍了三星的多窗口支持 - 屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在深化发展我的应用程序与执行GALAXY NOTE 2,很快银河S3推出的三星多窗口功能不兼容。如果你不知道我在说什么:


如果你有兴趣,这里是一个链接了解如何做到这一点:<一href=\"http://www.modaco.com/page/news/_/android/developers-add-support-for-samsung-multi-window-to-your-apps-r823\"相对=nofollow>这里

我的问题是,我需要知道的高度/宽度,我的应用程序使用。
我这样做:

  displaymetrics =新DisplayMetrics();
。getWindowManager()getDefaultDisplay()getMetrics(displaymetrics)。
heightScreen = displaymetrics.heightPixels;
widthScreen = displaymetrics.widthPixels;

但是,这将返回整个屏幕的大小,而不是我的应用程序使用的部分。我的活动仅由占据整个空间面板构成,但panel.getHeight()或的getWidth()返回0。

我怎样才能得到真正的高度/宽度?​​

先谢谢了。


解决方案

  

我的活动仅由占据整个空间面板构成,但panel.getHeight()或的getWidth()返回0。


请稍后再检查。你可能在的onCreate检查此(),这是太快AFAIK。

I'm currently developping my app to be compatible with the samsung multi window feature introduced with the galaxy note 2 and soon the galaxy s3. If you don't know what I'm talking about :
If you are interested, here is a link to know how to do it : here

My problem is that I need to know the height/width that my app uses. I'm doing this :

displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
heightScreen = displaymetrics.heightPixels;
widthScreen = displaymetrics.widthPixels;

But this returns the size of the entire screen, not just the part that my app uses. My activity is only compose by a Panel which take the entire space, but the panel.getHeight() or getWidth() return 0.

How can I get the real height/width ?

Thanks in advance.

解决方案

My activity is only compose by a Panel which take the entire space, but the panel.getHeight() or getWidth() return 0.

Try checking later. You are probably checking for this in onCreate(), which is too soon AFAIK.

这篇关于三星的多窗口支持 - 屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆