问题
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