I want to hold the vertical display for about 1 second before setting the screen horizontally in Monaca.

Asked 2 years ago, Updated 2 years ago, 134 views

Creating an app in MONACA

I'd like to fix the horizontal display with Android, but I'd like to pinch the vertical display once before that.

<preference name="Orientation" value="landscape"/>

It can be fixed horizontally with , but how can I insert the vertical display for about 1 second before that?

android monaca

2022-09-30 21:21

1 Answers

Dynamically changing the vertical and horizontal fixation changes the user's perspective and requires the terminal to rotate.
I don't recommend it because it can cause stress to users, but
If you want to use Monaca, you will need CordovaPlugin.
You must be in an available plan to use the plug-in.

The plug-ins that seemed to meet the requirements were listed below.
https://github.com/apache/cordova-plugin-screen-orientation

//Vertical fixation
screen.lockOrientation('portrait');
// Horizontal fixation
screen.lockOrientation('landscape');
// Fixed release
screen.unlockOrientation();

If you just want to pinch a vertical splash,
Instead of using the plug-in, you can turn the vertical image 90 degrees horizontally and register it.


2022-09-30 21:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.