stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.45k stars 933 forks source link

How to make android start full screen display #2240

Open lmj888cool opened 4 months ago

lmj888cool commented 4 months ago

I am using stride4.1 to develop an android mobile game. I have tried to make the game display in full screen on the phone screen, but it cannot cover the bangs, so there is a black border on the top of the phone.I want the full screen to include the notch part. Is there any developer who is using stride4.1 to develop android that has solved this problem? 20240501203131

MeharDT commented 4 months ago

In your project's GameSettings, what version of OpenGL is your project set to?

lmj888cool commented 3 months ago

image

Basewq commented 3 months ago

Full disclosure, I haven't tested this but since there is overlap between a 'standard' android app & xamarin, this solution might work https://learn.microsoft.com/en-us/answers/questions/640835/(xamarin-forms)how-to-make-app-run-in-fullscreen-i

Also posted below

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    if (Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.R)
    {
        Window.SetDecorFitsSystemWindows(false);
    }
    else
    {
        StatusBarVisibility option = (StatusBarVisibility)SystemUiFlags.LayoutFullscreen | (StatusBarVisibility)SystemUiFlags.LayoutStable;
        Window.DecorView.SystemUiVisibility = option;
    }
    Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
    Window.SetStatusBarColor(global::Android.Graphics.Color.Transparent);
}

Do tell if it works!

lmj888cool commented 3 months ago

Full disclosure, I haven't tested this but since there is overlap between a 'standard' android app & xamarin, this solution might work https://learn.microsoft.com/en-us/answers/questions/640835/(xamarin-forms)how-to-make-app-run-in-fullscreen-i

Also posted below

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    if (Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.R)
    {
        Window.SetDecorFitsSystemWindows(false);
    }
    else
    {
        StatusBarVisibility option = (StatusBarVisibility)SystemUiFlags.LayoutFullscreen | (StatusBarVisibility)SystemUiFlags.LayoutStable;
        Window.DecorView.SystemUiVisibility = option;
    }
    Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
    Window.SetStatusBarColor(global::Android.Graphics.Color.Transparent);
}

Do tell if it works!

It can be displayed in full screen, but the status bar above and the navigation bar below are always displayed. If the API to hide the status bar and navigation bar is called, it cannot be displayed in full screen again. . .

lmj888cool commented 3 months ago

Full disclosure, I haven't tested this but since there is overlap between a 'standard' android app & xamarin, this solution might work https://learn.microsoft.com/en-us/answers/questions/640835/(xamarin-forms)how-to-make-app-run-in-fullscreen-i Also posted below

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    if (Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.R)
    {
        Window.SetDecorFitsSystemWindows(false);
    }
    else
    {
        StatusBarVisibility option = (StatusBarVisibility)SystemUiFlags.LayoutFullscreen | (StatusBarVisibility)SystemUiFlags.LayoutStable;
        Window.DecorView.SystemUiVisibility = option;
    }
    Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
    Window.SetStatusBarColor(global::Android.Graphics.Color.Transparent);
}

Do tell if it works!

It can be displayed in full screen, but the status bar above and the navigation bar below are always displayed. If the API to hide the status bar and navigation bar is called, it cannot be displayed in full screen again. . .

04c680f7ad62cad4ccabb776ece49cf

Basewq commented 3 months ago

Sorry, I'm not sure I understand the problem, however I think you are closer to finding a solution for your issue by playing around with the Window settings in the Activity class. Maybe try the solution from this one? https://stackoverflow.com/a/67286155

If this solution doesn't work, you will probably have better luck just searching for solutions involving Android Xamarin or Android Monogame since they all involve the Activity class as the base class like in Stride, so there should be some overlap in the solution.