Splash Screen
Learn how to create Splash Screen page with animation using android studio
In this Video Im going to show you how to create a splash screen with transition (fadeOut) animation using android studio. So we're going to use the CountDownTimer and the AlphaAnimation.
Enjoy the video and dont forget to follow me on youtube.thank you all for watching
- set colors
- Edit App
- Create New Activity SplashscreenActivity
- Open the activity_splashscreen.xml
- Now Edit the SplashscreenActivity.java
- To remove the navbar edit the style.xml like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="colorPrimary">#212226</color> | |
<color name="colorPrimaryDark">#212226</color> | |
<color name="colorTitle">#5efdc5</color> | |
<color name="colorAccent">#f4f4f4</color> | |
<color name="colorFacebook">#3b5998</color> | |
<color name="colorPhone">#32CD32</color> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
</style> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="com.devam.splashscreen.SplashscreenActivity"> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@drawable/code"/> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@color/colorPrimaryDark" | |
android:alpha="0.9"/> | |
<ImageView | |
android:layout_width="90dp" | |
android:layout_height="90dp" | |
android:src="@drawable/ic_coding" | |
android:layout_centerHorizontal="true" | |
android:layout_above="@+id/title"/> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true" | |
android:text="@string/app_name" | |
android:textColor="@color/colorTitle" | |
android:textSize="33dp" | |
android:layout_margin="20dp" | |
android:fontFamily="serif-monospace" | |
android:textStyle="bold" | |
style="@style/TextAppearance.AppCompat.Headline" | |
android:id="@+id/title"/> | |
<TextView | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentBottom="true" | |
android:layout_centerHorizontal="true" | |
android:layout_margin="30dp" | |
android:text="Some Text... By devam" | |
android:textColor="@color/colorAccent" | |
android:fontFamily="serif-monospace" | |
style="@style/TextAppearance.AppCompat.Caption"/> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.devam.splashscreen; | |
import android.content.Intent; | |
import android.os.CountDownTimer; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.animation.AlphaAnimation; | |
import android.widget.TextView; | |
public class SplashscreenActivity extends AppCompatActivity { | |
private TextView mTitle; | |
private AlphaAnimation fadeOut; | |
@Override | |
protected void onCreate( Bundle savedInstanceState ) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_splashscreen); | |
fadeOut = new AlphaAnimation(0.0f, 1.0f); | |
mTitle = (TextView)findViewById(R.id.title); | |
mTitle.startAnimation(fadeOut); | |
fadeOut.setDuration(2000); | |
fadeOut.setFillAfter(true); | |
// duration, interval | |
new CountDownTimer(5000, 1000) { | |
@Override | |
public void onTick( long millisUntilFinished ) { | |
} | |
@Override | |
public void onFinish() { | |
Intent intent = new Intent(getApplicationContext(), MainActivity.class); | |
startActivity(intent); | |
} | |
}.start(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<!-- Customize your theme here. --> | |
<item name="colorPrimary">@color/colorPrimary</item> | |
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | |
<item name="colorAccent">@color/colorAccent</item> | |
</style> | |
</resources> |
Aucun commentaire:
Enregistrer un commentaire