有两种设置窗口旋转策略的方式:一、通过module.json5文件中“orientation”字段进行设置二、在代码中通过调用窗口window的setPreferredOrientation方法进行设置setPreferredOrientation是在调用该方法时进行窗口方向的设置,用于在应用启动之后,还需要改变显示方向的场景。建议使用setPreferredOrientation的方式参考文档1:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-landscape-and-portrait-development-V5参考文档2:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#setpreferredorientation9-1最佳实践:https://gitee.com/harmonyos\_samples/hand-writing-to-image
有两种设置窗口旋转策略的方式:
一、通过module.json5文件中“orientation”字段进行设置
二、在代码中通过调用窗口window的setPreferredOrientation方法进行设置
setPreferredOrientation是在调用该方法时进行窗口方向的设置,用于在应用启动之后,还需要改变显示方向的场景。建议使用setPreferredOrientation的方式
参考文档1:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-landscape-and-portrait-development-V5
参考文档2:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-window-V5\#setpreferredorientation9-1
最佳实践:https://gitee.com/harmonyos\_samples/hand-writing-to-image