[Flutter 实战] 固定屏幕方向 Landscape or

2019-11-07  本文已影响0人  寅丁

在此记录项目中所遇到问题及解决方案

把屏幕固定为竖屏

Future main() async {
    await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
    runApp(new MyApp());
  }

如果想固定插件所产生的页面,需要在原生项目里配置
比如Android,在 [project_root]\android\app\src\main\AndroidManifest.xml 文件里配置

这个我使用第三方裁剪图片库的Activity
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" //在这里配置
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

更多说明屏幕方向的资料见

上一篇 下一篇

猜你喜欢

热点阅读