mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
Allow rotating the screen without crashing by overriding the Configuration changes.
Restarting the activity is not a choice on orientation changes.
This commit is contained in:
@@ -5,19 +5,25 @@ using Android.App;
|
||||
using Android.OS;
|
||||
using Android.Content.PM;
|
||||
using Android.Views;
|
||||
using System;
|
||||
using Android.Runtime;
|
||||
using Android.Content.Res;
|
||||
|
||||
namespace SampleGame.Android
|
||||
{
|
||||
[Activity(Label = "SampleGame", MainLauncher = true, ScreenOrientation = ScreenOrientation.Landscape, Theme = "@android:style/Theme.NoTitleBar")]
|
||||
[Activity(Label = "SampleGame", ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, MainLauncher = true, Theme = "@android:style/Theme.NoTitleBar")]
|
||||
public class MainActivity : Activity
|
||||
{
|
||||
private SampleGameView sampleGameView;
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
Window.AddFlags(WindowManagerFlags.Fullscreen);
|
||||
Window.AddFlags(WindowManagerFlags.KeepScreenOn);
|
||||
SetContentView(new SampleGameView(this));
|
||||
|
||||
SetContentView(sampleGameView = new SampleGameView(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user