Google Pixel - Immersive Sticky Mode can't get rid of black bars

I have a game which runs full screen fine on various Android devices but on Google Pixel 2XL I can’t seem to get rid of the action bar or title bar properly. The icons and buttons tween off but the black background remains.

I think the code is all correct:
`<?xml version="1.0" encoding="utf-8"?>

@drawable/splash true false true


In MainActivity.cs I have this function which is called in OnCreate, OnResum, OnWindowFocusChanged
private void SetImmersive() { if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Kitkat) { Window.DecorView.SystemUiVisibility = (StatusBarVisibility)(SystemUiFlags.LayoutStable | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.LayoutFullscreen | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.ImmersiveSticky); } }

OnCreate has this
RequestWindowFeature(WindowFeatures.NoTitle); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);

GraphicsDeviceManger.ResetClientBounds tells me the bounds contain the bars still. If I hack the dimensions here I can get rid of the title bar black area but the action bar remains.

I did some Googling and it sounds like this is expected behaviour on the Pixel, but then some apps dont have this problem implying there must be a way around it.

Any ideas what to do?

Found a solution thanks to someone in the Xaramin forum. You need to add:

<meta-data android:name="android.max_aspect" android:value="2.1" />

To the AndroidManifest.xml
You don’t directly do this as it’s generated. Instead you must add:

[assembly: MetaData("android.max_aspect", Value = "2.1")]

To AssemblyInfo.cs

This will also be the case for Samsung Galaxy S8 and LG G6, and any others which are extra wide.

Hi! Raising up this topic because it still doesnt seem to work. Can someone actually bring the soluction to this ?
I test my game on real samsung s10 with the newest adroid. Followed all tips and code snippets from here and there. Even EXACTLY as pointed in this:
The game is still offset by 40 or so pixels from top (black bar).
Funny thing is that in the onCreate, device’s prefferedBackBuffer height is full (correct) and soon after “new GraphicsDeviceManager(this);” and when my resolution manager is reseting viewport its not full. Also debugging touch points reveals that when touched on black bar, the real y value is -40 or so.

Please look into this, I have just updated to 3.7.1… If I mummble too much or anyone wants more debug info Im happy to provide!

For a possible solution see my replay here. but first remove all other workarounds from your project, I don’t know how all that will interact with the default behavior. Also, dont set the graphics.PreferredBackBufferWidth/Height. On android those values are set automatically to the native window bounds.

Well, applied the activity config properties as you instructed, removed ingeration in prefferedbackbuffer… and still no change. I will probably just create blank monogame project from scratch and see if any of my code is the problem. Just to mention: problem didnt exist in 3.6.0

Did you replaced the monogame.dll reference with the one in the nuget link?

No. Is it brached from 3.7.1?

I’ve rebased it to the develop branch a couple of months ago, technically it’s based on 3.8.Something but that’s a bit simplistic way to describe it. For example a part of the fix to this specific bug was to revert changes that occur way back between 3.5 and 3.6 and then add some improvements on top of it.

Thank you for the insight. Unfortunatale I would rather revert to 3.6.0 (which I did now and immersive works fine) than test entire game on 3 platforms again :P.

1 Like