HarmonyOS鸿蒙Next中has.getWindowInfo这个接口返回的screenWidth和screenHeight描述写反了

HarmonyOS鸿蒙Next中has.getWindowInfo这个接口返回的screenWidth和screenHeight描述写反了 在文档中系统信息-基础-API-API参考-ASCF框架 - 华为HarmonyOS开发者这里的获取手机屏幕宽高screenWidth写的是屏幕高度,screenHeight写的是屏幕宽度,写反了

cke_825.png


更多关于HarmonyOS鸿蒙Next中has.getWindowInfo这个接口返回的screenWidth和screenHeight描述写反了的实战教程也可以访问 https://www.itying.com/category-93-b0.html

6 回复

您好,问题已修复,请您查看文档验证:has.getWindowInfo

更多关于HarmonyOS鸿蒙Next中has.getWindowInfo这个接口返回的screenWidth和screenHeight描述写反了的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


确实👍,

有要学HarmonyOS AI的同学吗,联系我:https://www.itying.com/goods-1206.html

尊敬的开发者,您好!感谢您的反馈,问题正在加速处理中,还请关注后续版本,感谢您的理解与支持。

在HarmonyOS Next中,has.getWindowInfo接口返回的screenWidthscreenHeight描述确实存在错误。screenWidth实际返回的是屏幕高度,screenHeight返回的是屏幕宽度。这是一个已知的文档描述错误,实际接口功能正常。

根据文档截图和代码规范,has.getWindowInfo() 接口返回的 screenWidthscreenHeight 字段描述确实存在笔误。在移动设备开发中,screenWidth 通常指屏幕的短边(宽度),screenHeight 指屏幕的长边(高度),而文档中的文字描述将两者颠倒。

开发者在实际调用该接口时,应以字段名称为准,即 screenWidth 对应屏幕宽度(短边),screenHeight 对应屏幕高度(长边)。建议开发时通过实际打印返回值进行验证,例如在竖屏模式下,screenWidth 值应小于 screenHeight

该问题属于文档描述错误,不影响接口功能。开发者可正常使用接口获取屏幕宽高,后续关注官方文档更新即可。

回到顶部