Splash Screen
activity.main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="#03A9F4"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="413dp"
android:layout_height="576dp"
android:layout_marginBottom="40dp"
android:rotationX="-8"
android:src="@drawable/bick"
app:layout_constraintBottom_toTopOf="@+id/textView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="51dp"
android:layout_marginBottom="40dp"
android:fontFamily="@font/knewave"
android:rotation="8"
android:text=" Bicker CLUB"
android:textColor="#EBF6F8F5"
android:textSize="60dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
</androidx.constraintlayout.widget.ConstraintLayout>
top.animation.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%"
android:fromYDelta="-100%"
android:duration="1500"/>
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500"/>
</set>
buttom.animation.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%"
android:fromYDelta="100%"
android:duration="1500"/>
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500"/>
</set>
MainActivity.java
package com.example.splashscreen;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
//variables
Animation topAnim, bottomAnim;
ImageView image;
TextView logo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
//Animation
topAnim= AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomAnim= AnimationUtils.loadAnimation(this,R.anim.buttom_anim
);
//hooks
image = findViewById(R.id.imageView);
logo = findViewById(R.id.textView);
image.setAnimation(topAnim);
logo.setAnimation(bottomAnim);
}
}
Comments
Post a Comment