Android Splash screen
An Android app takes some time to to start up, especially when the app is first launched on a device. A splash screen may display start up progress to the user or to indicate branding.
But on google we can find other methods to create a splash screen but in this tutorial we will see how to create splash screen just like youtube app's splash screen.
Step 1:
Create an new project in android studio
Step 2:
add a image into drawable folder to be displayed on the splash screen
let say the name of that image is "img.png"
Step 3:
create a layout file under drawable directory.
"background_splash.xml"
- android:drawable="@color/white"/>
android:gravity="center" android:src="@drawable/img"/>
Step 4:
create a new style
Step 5:
create a SplashActivity.java file
public class SplashActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); }}
Step 6:
make .splashActivity as a launcher activity in manifest file
android:name=".SplashActivity" android:theme="@style/SplashTheme">
Thats All!!
Now you can run your application.
You can watch video demo here:
0 comments: