Translate

Step-by-Step Tutorial to make an Unlock Splash Screen Android Application



Demo video of the App that will get created by following below tutorial:-

If you want a similar background as I have used in the app, here's the image that you can paste in the drawable folder,



Step 1:- Create a new android studio project.
 
Step 2:- Now add the following dependency “ maven {url "https://jitpack.io"} ” in project-level Gradle file:-
 
allprojects {

    repositories {

        jcenter()

        maven {url "https://jitpack.io"}

    }

}

Step 3:- Add the following library in the module-level gradle file:- 

compile 'com.github.cortinico:slidetoact:v0.1.0'

Step 4:-  Create a UI for activity_main.xml as follows:-

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:background="@drawable/sunrise"

    tools:context="com.example.himalayabhagwani.unlocksplashscreenapp.MainActivity">



    <com.ncorti.slidetoact.SlideToActView

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:layout_alignParentBottom="true"

        android:layout_marginLeft="8dp"

        android:layout_marginRight="8dp"

        android:layout_marginBottom="16dp"

        android:id="@+id/slide_to_unlock"

        android:elevation="10dp"

        app:area_margin="8dp"

        app:inner_color="#424242"

        app:outer_color="#90FFFFFF"

        app:text="Slide to unlock..." />


</RelativeLayout>

Step 5:- Create a new activity “HomeScreen” which will be traversed to after the slider slides on “activity_main.xml” :-
In activity_home_screen.xml,

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:background="@drawable/sunrise"

    tools:context="com.example.himalayabhagwani.unlocksplashscreenapp.HomeScreen">



    <TextView

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_centerHorizontal="true"

        android:layout_centerVertical="true"

        android:text="HOME \n    SCREEN"

        android:textSize="60sp"

        android:textColor="#ffffff"

        android:fontFamily="cursive"

        android:textStyle="bold"/>



</RelativeLayout>

Step 6:- Now just add a OnSlideCompleteListener on the slider in MainActivity.java
In MainActivity.java,

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.ncorti.slidetoact.SlideToActView;

import org.jetbrains.annotations.NotNull;

public class MainActivity extends AppCompatActivity {

    SlideToActView
slideToActView;

   
@Override
   
protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
        setContentView(R.layout.
activity_main);

       
slideToActView = (SlideToActView) findViewById(R.id.slide_to_unlock);
       
slideToActView.setOnSlideCompleteListener(new SlideToActView.OnSlideCompleteListener()
        {
           
@Override
           
public void onSlideComplete(@NotNull SlideToActView slideToActView) {
                startActivity(
new Intent(MainActivity.this,HomeScreen.class));
            }
        });

    }

   
@Override
   
protected void onResume() {
       
super.onResume();
       
slideToActView.resetSlider();
    }
}




Thank you for visiting my blog..!!

Motivate me by subscribing to my blog

Do check out our Google+ community. Links to all the posts that I have ever published on this blog are available there -- https://plus.google.com/communities/109145011090687795512

Don’t forget to follow me on Google+ so that we get to know each other… https://plus.google.com/+VinayakBhagwani

Do check out my other tutorials:-
1. Step-by-Step Tutorial to build a Simsimi ChatBot Android Application - LINK -- https://stathunt.blogspot.com/2018/07/tutorial-to-make-simsimi-chatbot.html

2. Step-by-Step Tutorial to create a beautiful UI in an Android Application using Transition Animation - LINK -- https://stathunt.blogspot.com/2018/07/step-by-step-tutorial-to-create-android.html

Comments

Popular posts from this blog

Step-by-Step tutorial to build an android application which reads text from an image like OCR, using Google Vision API

Tutorial to make a SimSimi Chatbot Android Application

Step-by-Step tutorial to make an Android Application which can scan text from the images that mobile camera shows using Google Vision API

You can now send voice messages on Instagram

Wanna use Themed WhatsApp.....??

Read This if you want to test your Android Applications BUT do not have a high configuration PC to test it on in-built Android Emulators

Step-by-Step Tutorial to create an Android Application with Transition Animation presented through Light Bulb

Web Terminology

How to Stop LinkedIn From Telling Someone You Viewed Their Profile