This is Sample Project Which you can improve UI design & Coding skills .
*This MainPage Connected to Tutorial (Splash Screen)*
*Next Tutorial Tutorial 2.*
1) Open android studio and make a new Project.
2) Then Download these files given below and paste "app-res" .
3)You need add this dependencies to build.gradle.
"implementation 'com.airbnb.android:lottie:3.4.1'"
You need to Download and paste these folders to your "res" folder. And also paste "font_certs.xml" to "values"
If you get any trouble. Please Contact me on WhatsApp!!
activity_main
MainActivity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:orientation="vertical"
tools:context=".MainActivity"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/top_gradient"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Covid Tracker"
android:textStyle="bold"
android:layout_marginTop="-40dp"
android:height="30dp"
android:fontFamily="sans-serif-smallcaps"
android:textAlignment="center"
android:textSize="25dp"
android:textColor="@color/white"
android:gravity="center_horizontal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie"
android:layout_width="match_parent"
android:layout_height="350dp"
android:scaleType="fitCenter"
android:layout_marginTop="20dp"
android:elevation="2dp"
app:lottie_repeatMode="restart"
app:lottie_repeatCount="1000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.25"
app:lottie_autoPlay="true"
app:lottie_rawRes="@raw/encounters" />
<TextView
android:id="@+id/welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome To Covid"
android:textAlignment="center"
android:fontFamily="@font/baloo"
android:textSize="35dp"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:layout_gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:text="@string/first_slide_desc"
android:gravity="center_horizontal" />
<Button
android:layout_width="300dp"
android:layout_height="50dp"
android:background="@drawable/button_style"
android:text="Login"
android:onClick="LoginBtn"
android:layout_gravity="center"
android:textSize="18dp"
android:textStyle="bold"
android:textColor="#FFF"
android:layout_marginTop="40dp"/>
<Button
android:layout_width="300dp"
android:layout_height="50dp"
android:background="@drawable/button_style"
android:layout_gravity="center"
android:onClick="RegisterBtn"
android:text="Register"
android:textSize="18dp"
android:textStyle="bold"
android:textColor="#FFF"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/powerd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:textColor="@color/blacks"
android:textAlignment="center"
android:textSize="15dp"
android:textStyle="bold"
android:text="Powerd By Chathura"
android:gravity="center_horizontal" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
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:orientation="vertical"
tools:context=".MainActivity"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/top_gradient"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Covid Tracker"
android:textStyle="bold"
android:layout_marginTop="-40dp"
android:height="30dp"
android:fontFamily="sans-serif-smallcaps"
android:textAlignment="center"
android:textSize="25dp"
android:textColor="@color/white"
android:gravity="center_horizontal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/lottie"
android:layout_width="match_parent"
android:layout_height="350dp"
android:scaleType="fitCenter"
android:layout_marginTop="20dp"
android:elevation="2dp"
app:lottie_repeatMode="restart"
app:lottie_repeatCount="1000"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.25"
app:lottie_autoPlay="true"
app:lottie_rawRes="@raw/encounters" />
<TextView
android:id="@+id/welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome To Covid"
android:textAlignment="center"
android:fontFamily="@font/baloo"
android:textSize="35dp"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:layout_gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:text="@string/first_slide_desc"
android:gravity="center_horizontal" />
<Button
android:layout_width="300dp"
android:layout_height="50dp"
android:background="@drawable/button_style"
android:text="Login"
android:onClick="LoginBtn"
android:layout_gravity="center"
android:textSize="18dp"
android:textStyle="bold"
android:textColor="#FFF"
android:layout_marginTop="40dp"/>
<Button
android:layout_width="300dp"
android:layout_height="50dp"
android:background="@drawable/button_style"
android:layout_gravity="center"
android:onClick="RegisterBtn"
android:text="Register"
android:textSize="18dp"
android:textStyle="bold"
android:textColor="#FFF"
android:layout_marginTop="10dp"/>
<TextView
android:id="@+id/powerd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:textColor="@color/blacks"
android:textAlignment="center"
android:textSize="15dp"
android:textStyle="bold"
android:text="Powerd By Chathura"
android:gravity="center_horizontal" />
</LinearLayout>
</ScrollView>
</LinearLayout>
package com.rrmchathura.myfirstapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView textView,powerd;
private String welcome_note;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
welcome_note = getString(R.string.welcom_note);
textView = findViewById(R.id.welcome);
powerd = findViewById(R.id.powerd);
textView.startAnimation((Animation) AnimationUtils.
loadAnimation(MainActivity.this,R.anim.animation_logo));
powerd.startAnimation((Animation) AnimationUtils.
loadAnimation(MainActivity.this,R.anim.translate));
}
public void LoginBtn(View view) {
startActivity(new Intent(MainActivity.this,LoginActivity.class));
finish();
}
public void RegisterBtn(View view) {
startActivity(new Intent(MainActivity.this,RegisterActivity.class));
finish();
}
}
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView textView,powerd;
private String welcome_note;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
welcome_note = getString(R.string.welcom_note);
textView = findViewById(R.id.welcome);
powerd = findViewById(R.id.powerd);
textView.startAnimation((Animation) AnimationUtils.
loadAnimation(MainActivity.this,R.anim.animation_logo));
powerd.startAnimation((Animation) AnimationUtils.
loadAnimation(MainActivity.this,R.anim.translate));
}
public void LoginBtn(View view) {
startActivity(new Intent(MainActivity.this,LoginActivity.class));
finish();
}
public void RegisterBtn(View view) {
startActivity(new Intent(MainActivity.this,RegisterActivity.class));
finish();
}
}
0 Comments