Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make android start full screen display #2240

Open
lmj888cool opened this issue May 1, 2024 · 6 comments
Open

How to make android start full screen display #2240

lmj888cool opened this issue May 1, 2024 · 6 comments
Labels
platform-Android question Further information is requested

Comments

@lmj888cool
Copy link

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

@lmj888cool lmj888cool added the question Further information is requested label May 1, 2024
@MeharDT
Copy link
Contributor

MeharDT commented May 15, 2024

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

@lmj888cool
Copy link
Author

image

@Basewq
Copy link
Contributor

Basewq commented Jun 1, 2024

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
Copy link
Author

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
Copy link
Author

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
Copy link
Contributor

Basewq commented Jun 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-Android question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants