Codename One landscape oriented Form in a portrait locked app

僤鯓⒐⒋嵵緔 提交于 2020-01-14 04:53:08

问题


I have a Codename One app which orientation is locked to portrait. That app is build to Android and iOS. It's a social and the portrait orientation is fine, except for video and images when they are landscape oriented.

To see a full screen image in a landscape orientation, I workarounded the problem rotating the image before showing it. However I suppose that the same workaround is not applicable to play a video.

How can I programmatically change the orientation of a Form to landscape when the app is locked to portrait? Otherwise, how can I satisfy the use case that I described? Thank you


回答1:


This only works on Android and doesn't work for our iOS port. Notice that if you use the setNativePlayerMode it will work for iOS as well but you won't have any control as described here: https://stackoverflow.com/a/59495797/756809

You can set orientation to landscape explicitly using CN.lockOrientation(false). You can release the lock using CN.unlockOrientation().

But this will only work on Android and won't really impact iOS.



来源:https://stackoverflow.com/questions/59493906/codename-one-landscape-oriented-form-in-a-portrait-locked-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!