Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Whenever I launch my app, the splash screen displays everywhere except on the notch area, please how can I fix that?

Here's my code:
Main Activity.java:
public class MainActivity extends AppCompatActivity {

    //Variables
    Animation topAnim, bottomAnim;
    ImageView image;
    TextView logo, slogan;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View decorView = getWindow().getDecorView();
// Hide the status bar.
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        setContentView(R.layout.activity_main);

        //Animations
        topAnim = AnimationUtils.loadAnimation(this,R.anim.top_animation);
        bottomAnim = AnimationUtils.loadAnimation(this,R.anim.bottom_animation);

        //Hooks
        image = findViewById(R.id.imageView);
        logo = findViewById(R.id.textView);
        slogan = findViewById(R.id.textView2);

        image.setAnimation(topAnim);
        logo.setAnimation(bottomAnim);
        slogan.setAnimation(bottomAnim);

        int SPLASH_SCREEN = 5000;
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(MainActivity.this, HomeActivity.class);
                startActivity(intent);
                finish();
            }
        }, SPLASH_SCREEN);
    }
}


Styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">#0347F4</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>   
</style>

</resources>


What I have tried:

Here's what I've tried: I added
<item name="android:WindowLayoutInDisplayCutoutmode"shortEdges</item>


to the style.xml but it only shows a white screen on the notch area.
Posted
Comments
David Crow 7-Apr-21 22:19pm    
Can you provide a screenshot?
Chinedum Ezeozue 7-Apr-21 23:12pm    
Sure https://drive.google.com/file/d/1UVvbGHXzcXHxt1fKd1be77D8kRjjcia_/view?usp=drivesdk
David Crow 8-Apr-21 8:21am    
I don't see anything missing from the pink area, nor do I see the display cutout (i.e., notch). Perhaps you've shown the wrong screenshot, or have explained the problem incorrectly?
Chinedum Ezeozue 8-Apr-21 12:55pm    
I fixed the error by adding this line to the cutoutmode.

tools:targetApi="o_mr1">shortEdges

But thanks for your concern
David Crow 8-Apr-21 13:14pm    
So what does the screenshot look like now (that differs than before)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900