samedi 11 août 2018

Splash Screen with animation using android studio - Welcome Screen android studio -






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


  1. set colors

  2. <?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>
    view raw color.xml hosted with ❤ by GitHub



  3. Edit App 

  4. <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>
    view raw style.xml hosted with ❤ by GitHub



  5. Create New Activity SplashscreenActivity




  6. Open the activity_splashscreen.xml

  7. <?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>



  8. Now Edit the SplashscreenActivity.java
  9. 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();
    }
    }



  10. To remove the navbar edit the style.xml  like this:

  11. <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>
    view raw style.xml hosted with ❤ by GitHub





Code : GITHUB

android studio , Welcome Screen android studio , Welcome Screen android studio , Splash Screen android studio , android studio splash screen , android studio design ui , transition ( fadeOut ) animation android studio,

Aucun commentaire:

Enregistrer un commentaire