I created a vanilla Android monogame app where I am hiding the navigation bar. I am drawing a square texture at 0,0, but this starts about 60 pixels down, leaving a blue strip across the top, the same size as the notification bar (not navigation). What do I need to do to draw on that top strip?
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
spriteBatch.Draw(myTexture, new Vector2(0,0), Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
Here’s my activity with changes to hide the navigation bar:
[Activity(Label = "AndroidGrayBar"
, 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)]
public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var g = new Game1();
SetContentView((View)g.Services.GetService(typeof(View)));
g.Run();
ConfigureDisplay();
}
private void ConfigureDisplay()
{
Window.DecorView.SystemUiVisibility = (StatusBarVisibility)(
(int)SystemUiFlags.Fullscreen
| (int)SystemUiFlags.HideNavigation
| (int)SystemUiFlags.ImmersiveSticky);
}
}