前提・実現したいこと
画面方向を垂直方向に固定したい。
発生している問題・エラーメッセージ
androidManifest.xmlのapplication節でandroid:screenOrientation="portrait"
と記載しても、縦方向に回転したり固定したりせず、あくまでデバイスの向きが優先
されます。
該当のソースコード
xml
1 <application 2 3 android:allowBackup="true" 4 android:icon="@mipmap/ic_launcher" 5 android:label="@string/app_name" 6 android:roundIcon="@mipmap/ic_launcher_round" 7 android:supportsRtl="true" 8 android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" 9 android:screenOrientation="portrait" 10 >
引用テキスト
試したこと
activity節に記載しても、縦方向への固定はできません。
むしろ、エラーとなります。下記がactivity節です。
xml
1 2 <activity android:name=".MainActivity" 3 android:screenOrientation="portrait" 4 5 > 6 <intent-filter> 7 <action android:name="android.intent.action.MAIN" 8 9 /> 10 11 <category android:name="android.intent.category.LAUNCHER" /> 12 </intent-filter> 13 </activity> 14
下記メッセージが、activity節に追記した箇所へ出ました。
Expecting android:screenOrientation="Unspecified" or "fullsensor" for this activity so the user can use the application in any orientation and provide a greate experience on Chrome OS devices.
補足情報(FW/ツールのバージョンなど)
android studio3.6.1使用
動作端末 702SO(Android 8.0.0)
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー