A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello @Kim Strasser ,
Thanks for your question.
- Since you target SDK 36.1, I recommend adding this one line before
base.OnCreate:
Platforms/Android/MainActivity.cs:
protected override void OnCreate(Bundle? savedInstanceState)
{
WindowCompat.SetDecorFitsSystemWindows(Window!, false);
base.OnCreate(savedInstanceState);
}
- These are inside the Google Material Android library (a NuGet dependency MAUI uses internally). That's why Visual Studio text search finds nothing, you didn't write this code, the library did.
I recommend updating your Nuget packages.
- In Visual Studio -> Tools -> NuGet Package Manager -> Manage Nuget Packages for Solution
- Go to Updates tab
- Update these packages to the latest versions:
Xamarin.Google.Android.Material (or Google.Android.Material)
Xamarin.AndroidX.Core
Xamarin.AndroidX.AppCompat
Also add this to your styles.xml:
<resources>
<style name="Maui.MainTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
</resources>
- Google's warning is a recommendation, not a hard requirement for games. Many games are landscape-only and this is accepted. However, Google wants you to declare that this is intentional.
When filling out your Store Listing or App Content section in Play Console, you can note that your game is designed for landscape mode. Google allows this with a valid reason.
I suggest adding android:resizeableActivity="false" explicitly:
Platforms/Android/AndroidManifest.xml
<activity
android:name="com.yourpackage.MainActivity"
android:screenOrientation="userLandscape"
android:resizeableActivity="false"
android:configChanges="orientation|screenSize|keyboard|keyboardHidden" />
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.