【问题标题】:What are Screen.width and Screen.height values?什么是 Screen.width 和 Screen.height 值?
【发布时间】:2017-08-24 15:09:37
【问题描述】:

我目前正在从事 Qt 上的移动开发。我不太明白Screen.widthScreen.height 返回的值。 我正在使用两种设备:Xperia Z5 Compact(720x1200 分辨率)和 Galaxy Tab 4 (1200x800)。但是在纵向上,我有(对于 xperia)

Screen.width = 320
Screen.height = 592

而对于银河系:

Screen.width = 601
Screen.height = 962

那么如果Screen 的属性widthheight 不是以像素为单位的分辨率,它们是什么?

【问题讨论】:

    标签: android qt qml qtquick2


    【解决方案1】:

    问题在于像素比例。这里有一个更好的解释:Device Pixel Ratio

    要找到真正的分辨率,试试这个:

    alert('window.devicePixelRatio*screen.width: ' + window.devicePixelRatio*screen.width);
    

    或者在你的智能手机上打开这个:Example of screen.width * window.devicePixelRatio

    【讨论】:

      猜你喜欢
      • 2013-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-18
      • 1970-01-01
      • 2015-06-16
      • 2012-05-23
      • 2020-06-03
      相关资源
      最近更新 更多