Application doesn't take the whole screen

Eduardo Gomez Romero 405 Reputation points
2024-09-04T01:46:39.0666667+00:00

So, I was checking out this post

https://video2.skills-academy.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>
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,410 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 42,001 Reputation points Microsoft Vendor
    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 Answers by the question author, which helps users to know the answer solved the author's problem.