Screen.width 和 Screen.height 值是什么?
What are Screen.width and Screen.height values?
我目前正在 Qt 上进行移动开发。我不太明白 Screen.width
和 Screen.height
返回的值。
我正在使用两种设备:Xperia Z5 Compact(720x1200 分辨率)和 Galaxy Tab 4(1200x800)。但是在纵向方向上,我有(对于 xperia)
Screen.width = 320
Screen.height = 592
而对于银河系:
Screen.width = 601
Screen.height = 962
那么如果 Screen
的属性 width
和 height
不是以像素为单位的分辨率,那它们是什么?
问题出在像素比上。这里有一个更好的解释:Device Pixel Ratio.
要找到真正的分辨率试试这个:
alert('window.devicePixelRatio*screen.width: ' + window.devicePixelRatio*screen.width);
或者在您的智能手机上打开:Example of screen.width * window.devicePixelRatio
我目前正在 Qt 上进行移动开发。我不太明白 Screen.width
和 Screen.height
返回的值。
我正在使用两种设备:Xperia Z5 Compact(720x1200 分辨率)和 Galaxy Tab 4(1200x800)。但是在纵向方向上,我有(对于 xperia)
Screen.width = 320
Screen.height = 592
而对于银河系:
Screen.width = 601
Screen.height = 962
那么如果 Screen
的属性 width
和 height
不是以像素为单位的分辨率,那它们是什么?
问题出在像素比上。这里有一个更好的解释:Device Pixel Ratio.
要找到真正的分辨率试试这个:
alert('window.devicePixelRatio*screen.width: ' + window.devicePixelRatio*screen.width);
或者在您的智能手机上打开:Example of screen.width * window.devicePixelRatio