mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-24 12:06:37 +00:00
53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using Android.App;
|
|
using Android.Content.PM;
|
|
using Android.OS;
|
|
using Android.Views;
|
|
|
|
namespace Demo.Android
|
|
{
|
|
[Activity(
|
|
Label = "Demo.Android",
|
|
MainLauncher = true,
|
|
Icon = "@drawable/icon",
|
|
Theme = "@style/Theme.Splash",
|
|
AlwaysRetainTaskState = true,
|
|
LaunchMode = LaunchMode.SingleInstance,
|
|
ScreenOrientation = ScreenOrientation.SensorLandscape,
|
|
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden)]
|
|
public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
|
|
{
|
|
protected override void OnCreate(Bundle bundle)
|
|
{
|
|
base.OnCreate(bundle);
|
|
|
|
var game = new GameMain();
|
|
var view = (View)game.Services.GetService(typeof(View));
|
|
|
|
HideSystemUi();
|
|
|
|
SetContentView(view);
|
|
game.Run();
|
|
}
|
|
|
|
private void HideSystemUi()
|
|
{
|
|
// https://developer.android.com/training/system-ui/immersive.html
|
|
|
|
if (Build.VERSION.SdkInt >= (BuildVersionCodes)19)
|
|
{
|
|
var decorView = Window.DecorView;
|
|
var uiVisibility = (int)decorView.SystemUiVisibility;
|
|
var options = uiVisibility;
|
|
|
|
options |= (int)SystemUiFlags.LowProfile;
|
|
options |= (int)SystemUiFlags.Fullscreen;
|
|
options |= (int)SystemUiFlags.HideNavigation;
|
|
options |= (int)SystemUiFlags.ImmersiveSticky;
|
|
|
|
decorView.SystemUiVisibility = (StatusBarVisibility)options;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|