Capacitor 在文档教程中有关于屏幕方向的信息 (https://capacitorjs.com/docs/v2/guides/screen-orientation#screen-orientation-in-your-capacitor-app),但是如何将应用程序切换到全屏? Cordova 在 config.xml 中有内置设置,但在电容器中我不知道如何制作它
最佳答案
使用 fullscreen plugin来自 Cordova(仍在使用 Capacitor)
npm install cordova-plugin-fullscreen
npm install @awesome-cordova-plugins/android-full-screen
ionic cap sync
然后在你的 App.tsx 中
AndroidFullScreen.isImmersiveModeSupported()
.then(() => AndroidFullScreen.immersiveMode())
.catch(console.warn);
在手机上试试
ionic cap run android --external -livereload
这将隐藏状态栏和导航按钮。 如果用户在状态栏所在的位置向下滑动,它会平滑显示 2 秒。
关于fullscreen - 如何制作全屏 ionic 电容器应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71288670/