How to remove the Actionbar from a SplashScreen

0

I just need to make the top bar disappear when the app starts with an image I put.

    
asked by Pipe Díaz 15.10.2018 в 18:12
source

1 answer

0

I think the best way to create the splash would be:

1: Create a splash.xml resource in the drawable folder

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:drawable="@color/colorPrimary"/>
  <item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/inicioimg"/>
</item>

</layer-list>

2. Create an activity (SplashActivity) without a layout in which you define where you want to go after loading your splas.

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

            Intent i = new Intent(getApplicationContext(), MainActivity.class);
            startActivity(i);
            finish();
 }
}
  • in your Manifest say you're going to start with that screen:
  • <activity
        android:name=".SplashActivity"
        android:theme="@style/splashScreen">
                
    </activity>
  • you can write about the Application class to tell you how long it will take for the splash

    SystemClock.sleep (2000);

  • answered by 15.10.2018 в 18:22