문제

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 :
(source: androidheadlines.com)

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top