Splash Screen
SplashActivity.java
import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class SplashActivity extends AppCompatActivity { private static int SPLASH_TIME_OUT = 4000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent homeIntent=new Intent(SplashActivity.this,MainActivity.class); startActivity(homeIntent); finish(); } },SPLASH_TIME_OUT); } }
activity_splash.xml
<android.support.constraint.ConstraintLayout 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" android:background="#84ffff" tools:context=".SplashActivity"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="168dp" app:layout_constraintBottom_toBottomOf="parent" app:srcCompat="@drawable/logo" tools:ignore="MissingConstraints" tools:layout_editor_absoluteX="0dp" /> </android.support.constraint.ConstraintLayout>
drawable dosyasını logo.png adında bir resim ekliyoruz