Splash Screen

Buat Activity Baru

  • Buat Empty Activity baru dan namakan "SplashScreenActivity

Layout 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=".SplashScreenActivity">

    <ImageView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_centerInParent="true"
        android:src="@drawable/logo_digital_talent" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="64dp"
        android:fontFamily="@font/purista_bold"
        android:text="DTS x PENS"
        android:textColor="@color/deep_blue"
        android:textSize="32sp"
        android:textStyle="normal" />

</RelativeLayout>

SplashScreenActivity

public class SplashScreenActivity extends AppCompatActivity {

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

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                startActivity(new Intent(SplashScreenActivity.this, LoginActitivity.class));
                finish();
            }
        }, 2000);


    }
}

AndroidManifest

  • Ubah Main Launcher di AndroidManifest menjadi SplashScreenActivity

Last updated

Was this helpful?