8
6

More than 3 years have passed since last update.

Androidの画面向きを固定した際に出るワーニングを無視する

Posted at

AndroidManifest.xml で画面の向きを固定しているとWarningが出るようになりました。

Expecting android:screenOrientation="unspecified" or "fullSensor" for this activity so user can use the application in any orientation and provide a great experience on Chrome OS devices

どの向きでも使えるようにしたほうがユーザ体験がいいので unspecifiedfullSensor を使うことを推奨するWaningなので、画面を固定しなければならないアプリではWarningを無視するパラメータを追加すると良いと思います。

AndroidManifest.xml
    // tools:ignore="LockedOrientationActivity" で無視
    // 全体的に無視したい場合はapplicationで設定
    <application
        android:icon="@drawable/app_icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:ignore="LockedOrientationActivity">

    </application>

参考

https://stackoverflow.com/questions/58519021/in-androidmanifest-expecting-androidscreenorientation-unspecified
https://developer.android.com/guide/topics/manifest/activity-element?hl=ja

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6