【Xamarin+MonoGame】Androidで画面の向きを指定する

2017-01-18 10:00:49

  1. Xamarin.Android
  2. 開発
  3. MonoGame+Xamarin
Xamarin.Android+MonoGameメモシリーズ。Androidの画面向きの指定方法です。
[スポンサードリンク]
「Activity1.cs」の「ScreenOrientation」の値を変更します。 デフォルトは「ScreenOrientation.FullUser」となっていて、端末の「自動回転」が有効なら、画面を横にすると横画面に代わります。
[Activity(Label = "Game1"
		, MainLauncher = true
		, Icon = "@drawable/icon"
		, Theme = "@style/Theme.Splash"
		, AlwaysRetainTaskState = true
		, LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
		, ScreenOrientation = ScreenOrientation.FullUser
		, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize)]
横画面に固定したい場合は「ScreenOrientation.Landscape」、縦画面に固定したい場合は「ScreenOrientation.Portrait」に設定しましょう。
[スポンサードリンク]

コメント

[スポンサードリンク]
[スポンサードリンク]