Application doesn't take the whole screen

Eduardo Gomez Romero 1,375 Reputation points
2024-09-04T01:46:39.0666667+00:00

So, I was checking out this post

https://learn.microsoft.com/en-us/answers/questions/1389175/how-to-remove-the-splash-screen-in-maui-applicatio

and I removed the spas for my app (I plan to create a Json animation)

the problem that I have is that if i put the hone Lanscape mode I can see a lithe bit of the wallpaper

User's image

User's image

what I added

Android Main activity

    [Activity(Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
    public class MainActivity : MauiAppCompatActivity {     } }


Android/Colors

<?xml version="1.0" encoding="utf-8"?>
<resources>
	<style name="MainTheme" parent="Maui.SplashTheme">
		<item name="android:windowIsTranslucent">true</item>
		<item name="android:windowSplashScreenAnimationDuration">0</item>
	</style>
    <color name="colorPrimary">#512BD4</color>
    <color name="colorPrimaryDark">#2B0B98</color>
    <color name="colorAccent">#2B0B98</color>
</resources>

and I removed the call to the splash

<ItemGroup>
	<!-- App Icon -->
	<MauiIcon Include="Resources\AppIcon\appicon.svg" />
	<!-- Images -->
	<MauiImage Include="Resources\Images\*" />
	<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" /> 
	
	<!-- Custom Fonts -->
	<MauiFont Include="Resources\Fonts\*" />
	<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
	<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

Answer accepted by question author
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,151 Reputation points Microsoft External Staff
    2024-09-04T09:08:53.4566667+00:00

    Hello,

    The reason for this problem is that the Moto G22 is a device with a hole-punch camera. For devices with a hole-punch camera, Google has set a default restriction that it does not take up space when the screen is placed horizontally.

    Workaround:

    Add <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> in Style to use the left space.

    <style name="MainTheme" parent="Maui.SplashTheme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
    <item name="android:windowSplashScreenAnimationDuration">0</item>
    </style>
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.