How to create Splashscreen | Android Studio.
Splashscreen
1)Open Android Studio.
2)Create one empty activity.
3)Import the image.
4)Goto java and create the New handler activity and set delay time.
5) Run the Emulater.
Code for xml:-
<?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=".MainActivity">
<ImageView
android:layout_width="match_parent"
android:src="@drawable/logo"
android:layout_margin="10dp"
android:id="@+id/img"
android:background="#CFAB62"
android:layout_height="300dp"/>
<TextView
android:layout_width="match_parent"
android:layout_below="@+id/img"
android:text="THE ACX"
android:textSize="40dp"
android:textAlignment="center"
android:layout_margin="20dp"
android:textColor="#000"
android:layout_height="wrap_content"/
</RelativeLayout>
Code for java (New Handler Activity):-
package com.example.theacx;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i =new Intent(MainActivity.this,homeactivity.class);
startActivity(i);
finish();}
},4000);}}
Comments
Post a Comment