收藏
回答

wx.getWindowInfo()在多端打包Android场景下safeArea值存在BUG?

    console.log("=========" ) 
    let notice = ""
      const windowInfo = wx.getWindowInfo()
    for (let key in windowInfo) {
      if (windowInfo.hasOwnProperty(key)) {
        if(typeof windowInfo[key] === 'object'){
          let child =  windowInfo[key]
          for (let key2 in child) {
            notice += `${key}.${key2}: ${child[key2]}; <br/> `
            console.log(`${key}.${key2}: ${child[key2]}`);
          }
        }else{
          notice +=  `${key}: ${windowInfo[key]}; <br/> `
          console.log(`${key}: ${windowInfo[key]}`);
        }
      }
    }
    console.log("=========" )


同一手机, 在 "libVersion": "3.8.0" 和 android 平台 "minSdkVersion": 21 的基础上测试:

"sdkVersion": "1.7.0-beta.11-1423-SNAPSHOT" 和 "sdkVersion": "1.6.24" 均测试过

 "targetSdkVersion": 35/36 的情况下 windowInfo.safeArea 返回的值有问题

 "targetSdkVersion": 30/31/32/33/34 的情况下 windowInfo.safeArea 返回的值是正常的

通过android原生代码测试是正常的.

在redmi k60 ultra 上测试结果如下:

错误值:
pixelRatio:3;
screenWidth: 407; screenHeight: 904;
windowWidth: 407; windowHeight: 817;
safeArea.width: 407;safeArea.height: 865;
afeArea.left: 0; safeArea.right: 407;
safeArea.top: 39; safeArea.bottom: 904;
statusBarHeight: 39;
screenTop: 87;
正确的值:
pixelRatio: 3;
screenWidth: 407;screenHeight: 857;
windowWidth: 407;windowHeight: 857;
safeArea.width: 407;safeArea.height: 818;
safeArea.left: O;safeArea.right: 407;
safeArea.top: 39;safeArea.bottom: 857;
statusBarHeight: 39;
screenTop: 0;
回答关注问题邀请回答
收藏

2 个回答

  • 蓝龙
    蓝龙
    03-12

    错误编译版本中:

    env(safe-area-inset-bottom) 的值 也是0

    03-12
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    03-12
    有用
登录 后发表内容