Issue with Full HD + Resoulution in Android

Hello. I have an Android Project.

I want to Draw Some Items/Text on the top/bottom corners.
When I run it on Android Device with 1920x1080 resolution - all working good

But when I run it on Android Device with modern 2280x1080 resolution(Xiaomi Redmi 6 Pro) I can’t draw anything on the top/bottom corners

My Draw Code:
spriteBatch.DrawString(font, “Hello world!”, Vector2.Zero, Color.Black);

My code in Game1:
graphics.IsFullScreen = true,
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;

and in Activity1:

Here is a image example:

What am I doing wrong? I want to draw on the top and bottom corners!

the problem is clearly in the viewport, you are using the default 16/9 aspect ratio.
check this

but how to change it? graphics.GraphicsDevice.Viewport.AspectRatio is readonly and also, if I change graphics.GraphicsDevice.ViewPort to a new Viewport, i got NullPointerReference but I create new Viewport properly!
new Viewport(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

A fast way to do it is to set the PreferredBackBufferWidth/Height to the client screen width/height, but that will mess up the scaling.
so what you will need to do is to fix the width or the height, and set the other one relatively to the screen aspect ratio.
for example:

graphics.PreferredBackBufferHeight = graphics.PreferredBackBufferWidth*(Window.ClientBounds.Height/Window.ClientBounds.Width);

Just so you know the prefered version is meant to be used on construction and imply’s it is not a guarenteed change to the back buffer hence the name it is a hint.

Once you have intialized the graphics device basically by the time you are in load or when the game is running.

you can alternately call.

GraphicsDevice.PresentationParameters.BackBufferWidth =
GraphicsDevice.PresentationParameters.BackBufferHeight =

you must then call ApplyChanges() for the above …

Technically the above is meant to be used in concert with one of the existing display modes Width Height found from a list of support display modes queryed thru the below function.

or thru the CurrentAdapter

if you have the hardware switch on that is.

If you go into full screen via hardware mode = true i.e. you really change mode in order to ensure you have a true hd mode running and not do a windowed fs in the case you are doing fake full screen then you are using the users CurrentDisplayMode

Not sure how that relates in android resolution wise to be honest as android is probably somewhat different but on pc’s.

Then if that is not a valid (supported) Display mode resolution, preffered wont do a switch then you will again have the problem were the mouse and even the display is improperly matched up to the monitor resolution.
A valid display mode also includes matching the aspect ratio color format and refresh rate but you really only need to worry about the w h and aspect to do a switch.
That can be set by preffered at the start but again it must match a users supported display mode in order to do so if the intention is to ensure a true hd DisplayMode is switched to.

Im pretty sure the viewport can be changed as well but i forget how to do it.

Here is the last mode testing app i made its for windows gl desktop but it works on dx too i have no idea if you can port this over to your android app as i never tried but its really just straight up monogame class files and a font, maybe it will help.

Hitting f10 after you run this app will put you in fullscreen hitting f9 subsequently will do actual hardware mode switches thru your available supported display modes at least on pc this method calls a search function to match the requested w h to the closest supported display mode, to do so.

I don’t understand how it should work:(. Android always set graphics.PreferedBackBufferWidth and Heigth as resoulution(so 2280 and 1080 in my case). Also, I scale everything what I draw with coefficients already. I don’t need this, I guess. But there is still empty area in the top and the bottom :frowning:

GraphicsDevice.PresentationParameters.BackBufferWidth -> I got null reference error :frowning:

Hi ImperialMan.
Did you found a solution?

In my branch of MonoGame android I have a different handling of resolution and rotation.
Hopefully it will work for you.

You can try it from here:

hey, where is I can check source code?

The two commits that I think are relevant are the following. The binary was build from the tnc_Develop branch.