Splash Screen என்ற சொல்லின் அர்த்தம் என்னவென்றால் மென்பொருள் (Software) ஒன்றின் அறிமுக பக்கமாகும். அதில் படங்கள்(Image), லோகோ(Logo), மற்றும் மென்பொருள் உருவாக்கப்பட்ட நிறுவனத்தின் பெயர் என்பனவற்றுடன் மென்பொருளின் பதிப்பு போன்ற விடயங்கள் காணப்படும்.
1. app > res > layout> activity_splash_screen க்கு சென்று கீழே தரப்பட்டுள்ள Code ஐ உள்ளீடு செய்யுங்கள்.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayoutxmlns: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"
android:background="@drawable/splash_screen">
<ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.499"
app:srcCompat="@drawable/logo" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView4"
app:layout_constraintVertical_bias="0.90999997"
app:srcCompat="@drawable/developer" />
</androidx.constraintlayout.widget.ConstraintLayout>
2.app > java > your(package) > splash_screen க்கு சென்று கீழே தரப்பட்டுள்ள Code ஐ உள்ளீடு செய்யுங்கள்.
package com.mit.solution.app;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import static java.lang.Thread.sleep;
public class splash_screen extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start_screen);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
sleep(3000);
Intent i = new Intent(splash_screen.this,Home.class);
startActivity(i);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
thread.start();
}
}
கருத்துரையிடுக