Android Studio - Splash Screen
1. Buka Android Studio
2. Create New Project
a. Isikan Nama Project kalian. dan Next
b. Jadi jika anda memakai Lolipop, maka os dibawah lolipop tidak akan support dengan project anda.
e. Tampilan Building akan seperti ini
f. Tampilan Awal
3. Create New > Activity > Empty Activity (untuk activity Splash Screen nya)
4. Source Code Android Studio ( AndroidManifest.xml )
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.asus.zetkaisplashscreen">
- <application
- android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_launcher_round"
- android:supportsRtl="true"
- android:theme="@style/AppTheme">
- <activity android:name=".MainActivity"></activity>
- <activity android:name=".splashscreen">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
5. Source Code Android Studio ( MainActivity.java )
- package com.example.asus.zetkaisplashscreen;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- public class MainActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
- }
6. Source Code Android Studio ( splashscreen.java )
- package com.example.asus.zetkaisplashscreen;
- import android.content.Intent;
- import android.os.Handler;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.Window;
- import android.widget.TextView;
- public class splashscreen extends AppCompatActivity {
- TextView copyright1;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- //menghilangkan Action barr
- this.requestWindowFeature(Window.FEATURE_NO_TITLE);
- setContentView(R.layout.activity_splashscreen);
- copyright1 = (TextView) findViewById(R.id.copyright1);
- final Handler handler = new Handler();
- handler.postDelayed(new Runnable() {
- @Override
- public void run() {
- startActivity(new Intent(getApplicationContext(), MainActivity.class));
- finish();
- }
- }, 2000L); //2000 L = 2 detik
- }
- }
7. Source Code Android Studio ( activity_main.xml )
- <?xml version="1.0" encoding="utf-8"?>
- <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"
- tools:context=".MainActivity">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Hello Zetkai"
- android:textSize="50dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintLeft_toLeftOf="parent"
- app:layout_constraintRight_toRightOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
- </android.support.constraint.ConstraintLayout>
8. Source Code Android Studio ( activity_splashscreen )
- <?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=".splashscreen"
- android:background="@drawable/zk">
- <RelativeLayout
- android:background="#50330033"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:layout_width="366dp"
- android:layout_height="218dp"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="140dp"
- android:src="@drawable/zk1" />
- <TextView
- android:id="@+id/copyright1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentStart="true"
- android:layout_marginBottom="90dp"
- android:fontFamily="serif-monospace"
- android:text="Powered by ©Zetkai"
- android:textAlignment="center"
- android:textColor="#000000"
- android:textStyle="italic"
- android:textSize="20dp"/>
- </RelativeLayout>
- </RelativeLayout>
9. Untuk Source Code lengkapnya bisa di unduh di sini http://ouo.io/7YfOaV0
10. Demo Aplikasi








Komentar
Posting Komentar