Step 1 home.xml
<?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=".home_page">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#EEEEEE">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:gravity="center"
android:orientation="vertical"
android:background="@drawable/backgroung1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quotes App"
android:textSize="30sp"
android:textStyle="bold"
android:textColor="#ffff">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="210dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:cardCornerRadius="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/love"
android:src="@drawable/love"
android:layout_centerInParent="true">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Love"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:textColor="#000"
android:layout_below="@+id/love">
</TextView>
<Button
android:id="@+id/shayari"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:cardCornerRadius="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/dard"
android:src="@drawable/dard"
android:layout_centerInParent="true">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtrute"
android:text="Dard"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:textColor="#000"
android:layout_below="@+id/dard">
</TextView>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/shayari1"
android:background="@android:color/transparent">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:cardCornerRadius="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/Attitude"
android:src="@drawable/attitude"
android:layout_centerInParent="true">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txthistory"
android:text="Attitude"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:textColor="#000"
android:layout_below="@+id/Attitude">
</TextView>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/shayari2"
android:background="@android:color/transparent">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:cardCornerRadius="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/Birthday"
android:src="@drawable/birthday"
android:layout_centerInParent="true">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtfeedback"
android:text="Birthday"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:textColor="#000"
android:layout_below="@+id/Birthday">
</TextView>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/shayari3"
android:background="@android:color/transparent">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:cardCornerRadius="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/Motivational"
android:src="@drawable/motivational"
android:layout_centerInParent="true">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtsetting"
android:text="Motivational"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:textColor="#000"
android:layout_below="@+id/Motivational">
</TextView>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/shayari4"
android:background="@android:color/transparent">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="160dp"
android:layout_weight="1"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
app:cardCornerRadius="20dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/Funny"
android:src="@drawable/funny"
android:layout_centerInParent="true">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtsupport"
android:text="Funny"
android:textSize="16sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:textColor="#000"
android:layout_below="@+id/Funny">
</TextView>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/shayari5"
android:background="@android:color/transparent">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Step 2 home.java
package in.learncodewithrk.quoteapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class home_page extends AppCompatActivity {
Button shayari,shayari1,shayari2,shayari3,shayari4,shayari5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home_page);
shayari = (Button) findViewById(R.id.shayari);
shayari.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent streamIntent = new Intent(home_page.this, shayari_page1.class);
startActivity(streamIntent);
}
});
shayari1 = (Button) findViewById(R.id.shayari1);
shayari1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent streamIntent = new Intent(home_page.this, shayari_page2.class);
startActivity(streamIntent);
}
});
shayari2 = (Button) findViewById(R.id.shayari2);
shayari2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent streamIntent = new Intent(home_page.this, shayari_page3.class);
startActivity(streamIntent);
}
});
shayari3 = (Button) findViewById(R.id.shayari3);
shayari3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent streamIntent = new Intent(home_page.this, shayari_page4.class);
startActivity(streamIntent);
}
});
shayari4 = (Button) findViewById(R.id.shayari4);
shayari4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent streamIntent = new Intent(home_page.this, shayari_page5.class);
startActivity(streamIntent);
}
});
shayari5 = (Button) findViewById(R.id.shayari5);
shayari5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent streamIntent = new Intent(home_page.this, shayari_page6.class);
startActivity(streamIntent);
}
});
} }
GITHUB : https://github.com/LearncodeWithRk/Quotes-Shayari-App
0 Comments