How to Create Spalace Layout :-
Now create a activity and add following code :
1. XML File
<?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=".SpalaceAct"
android:background="@drawable/side_nav_bar">
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="186dp"
android:layout_marginTop="150dp"
app:srcCompat="@mipmap/logo_image" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView2"
android:layout_marginTop="146dp"
android:gravity="center"
android:text="from"
android:textColor="#1C721C"
android:textSize="20dp" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="FACEBOOK"
android:textColor="#0FDB0F"
android:textSize="25dp" />
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView2"
android:layout_marginTop="55dp" />
<!-- <ProgressBar
android:layout_below="@+id/imageView2"
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />-->
</RelativeLayout>
2. Java file
package com.example.demodrawernaviga2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.ClipData;
import android.content.Intent;
import android.os.Bundle;
public class SpalaceAct extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_spalace);
Thread background = new Thread() {
public void run() {
try {
// Thread will sleep for 5 seconds
sleep(1*1000);
// After 5 seconds redirect to another intent
Intent i=new Intent(getBaseContext(),MainActivity.class);
startActivity(i);
//Remove activity
finish();
} catch (Exception e) {
}
}
};
// start thread
background.start();
}
}
1. XML File
<?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=".SpalaceAct"
android:background="@drawable/side_nav_bar">
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="186dp"
android:layout_marginTop="150dp"
app:srcCompat="@mipmap/logo_image" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView2"
android:layout_marginTop="146dp"
android:gravity="center"
android:text="from"
android:textColor="#1C721C"
android:textSize="20dp" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView2"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="FACEBOOK"
android:textColor="#0FDB0F"
android:textSize="25dp" />
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView2"
android:layout_marginTop="55dp" />
<!-- <ProgressBar
android:layout_below="@+id/imageView2"
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />-->
</RelativeLayout>
2. Java file
package com.example.demodrawernaviga2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.ClipData;
import android.content.Intent;
import android.os.Bundle;
public class SpalaceAct extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_spalace);
Thread background = new Thread() {
public void run() {
try {
// Thread will sleep for 5 seconds
sleep(1*1000);
// After 5 seconds redirect to another intent
Intent i=new Intent(getBaseContext(),MainActivity.class);
startActivity(i);
//Remove activity
finish();
} catch (Exception e) {
}
}
};
// start thread
background.start();
}
}
0 comments:
Post a Comment