Getting screen size of Android virtual device
-
wrote on 13 Mar 2017, 16:39 last edited by A Former User
All,
'am running the following code snippet in Qt to get the screen size of my android virtual device.
QApplication app(argc, argv); QDesktopWidget *mydesk = app.desktop(); // redundant but using both showFullScreen and showMaximized... // ...just to play it safe mydesk->showMaximized(); mydesk->showFullScreen(); QScreen *screen = app.primaryScreen(); int width = screen->size().width(); int height = screen->size().height();
I created a Nexus 5 Android Virtual Device with resolution 1080x1920 to test my code and my width and height values are 1080x1776 instead of the expected 1080x1920. What 'am I doing wrong here? Can someone please help me?
Thanks
-
Hi,
Just a wild guess, but isn't that the size without the top bar ?
-
wrote on 13 Mar 2017, 23:36 last edited by
Thanks @SGaist. My guess was the same but I do not know how to prove it. Any thoughts?
-
Does your application cover the status bar ?
-
@Treazy
Hi
You dont really have to prove it.
Many other have wondered.
https://forum.xda-developers.com/xperia-z/general/hd-t22389291080x1776 too much a magic number to be a coincidence ( IMHO)
I wonder when you create a Nexus 5 Android Virtual Device, it must know from some where
the size of the bar.But if app covers bar ( as @SGaist asks) then it might be bug in the virtual device as as far as i know
(some) info apps will report full size if app is fullscreen. -
wrote on 15 Mar 2017, 17:29 last edited by
1/6