Android: Opt out of edge to edge enforcement on api 35+
Android 35+ enforces apps extending "Edge to Edge" by default. See https://github.com/dotnet/maui/issues/24742 for details.
For now, a better compromise is to disable this by default in MAUI apps, until we can provide better support for edge to edge within .NET MAUI itself as well as better safe area insets on Android.
If you still want to manually make your app more compatible with edge to edge, you can disable this implicit opt out by including a similar (inverse) style:
<style name="DisableOptOutEdgeToEdgeEnforcement">
<item name="android:windowOptOutEdgeToEdgeEnforcement">false</item>
</style>
And then applying it in the same way by calling it before the base.OnCreate(..) in your activity subclass (in the OnCreate method override):
protected override void OnCreate(Bundle? savedInstanceState)
{
// Disable Edge to Edge opt out by calling this before base.OnCreate()
Theme?.ApplyStyle(Resource.Style.DisableOptOutEdgeToEdgeEnforcement, force: true);
base.OnCreate(savedInstanceState);
}
The new "Default" of opting out of the Edge to Edge enforcement on an Android 35+ device looks now like this:
If you revert to the old behaviour by disabling the opt out, it will look like this: