代号纵向锁定应用程序中的一个横向表单 [英] Codename One landscape oriented Form in a portrait locked app

查看:61
本文介绍了代号纵向锁定应用程序中的一个横向表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Codename One应用,其方向被锁定为纵向。该应用程序是在Android和iOS上构建的。这是一种社交方式,肖像方向很好,除了视频和图像为横向时除外。

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.

当应用锁定为纵向模式时,如何以编程方式将Form的方向更改为横向?否则,如何满足我描述的用例?谢谢

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

推荐答案

这仅适用于Android,不适用于我们的iOS端口。请注意,如果您使用 setNativePlayerMode ,它也适用于iOS,但您将无法如此处所述进行任何控制: https://stackoverflow.com/a/59495797/756809

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

您可以使用 CN.lockOrientation(false)。您可以使用 CN.unlockOrientation()释放锁定。

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

但这仅适用于Android,不会真正影响iOS。

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

这篇关于代号纵向锁定应用程序中的一个横向表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆