Android

Quotes app using android Studio

In this article i am gone to share a beautiful android Quotes app | this is my first android app, there are some Quotes App Screenshot which you can see..

Quotes App Screenshot

 

 

xml code

<?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="wrap_content"
    android:orientation="vertical"
    tools:context=".MainActivity">

<ScrollView
android:layout_width=”match_parent”
android:layout_height=”wrap_content”>

<LinearLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:orientation=”vertical”>

<ImageView
android:id=”@+id/imageView4″
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:adjustViewBounds=”true”
android:contentDescription=”TODO”
android:scaleType=”centerCrop”
app:srcCompat=”@drawable/background” />

<LinearLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:layout_marginStart=”20dp”
android:layout_marginLeft=”20dp”
android:layout_marginTop=”20dp”
android:layout_marginEnd=”20dp”
android:layout_marginRight=”20dp”
android:gravity=”center_horizontal”
android:orientation=”vertical”>

<TextView
android:id=”@+id/textView4″
android:layout_width=”327dp”
android:layout_height=”wrap_content”
android:layout_marginStart=”-20dp”
android:layout_marginLeft=”-20dp”
android:background=”@drawable/textview_bg”
android:fontFamily=”cursive”
android:gravity=”center_vertical”
android:paddingLeft=”10dp”
android:paddingTop=”10dp”
android:paddingBottom=”10sp”
android:text=”Welcome to New World”
android:textColor=”#fff”
android:textSize=”35sp” />

<TextView
android:id=”@+id/textView5″
android:layout_width=”159dp”
android:layout_height=”wrap_content”
android:layout_marginTop=”40dp”
android:background=”@drawable/textview_bg”
android:fontFamily=”@font/qwigley”
android:gravity=”center|center_horizontal”
android:text=”Love Quotes”
android:textColor=”#FFFFFF”
android:textSize=”28sp” />

<TextView
android:id=”@+id/quote”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:layout_marginTop=”10dp”
android:fontFamily=”@font/qwigley”
android:gravity=”center_horizontal”
android:paddingTop=”10dp”
android:text=”@string/in_all_the_world_there_is_no_heart_for_me_like_yours_in_all_the_world_there_is_no_love_for_you_like_mine”
android:textColor=”#434545″
android:textSize=”40sp” />

<Button
android:id=”@+id/btnshare”
android:layout_width=”345dp”
android:layout_height=”wrap_content”
android:layout_marginTop=”30dp”

android:layout_marginEnd=”-10dp”
android:layout_marginRight=”-10dp”
android:background=”@drawable/textview_bg”
android:drawableRight=”@drawable/share”
android:drawableTint=”#fff”
android:fontFamily=”cursive”
android:foregroundGravity=”center|center_horizontal”
android:gravity=”center”
android:includeFontPadding=”false”
android:paddingLeft=”40dp”
android:paddingRight=”40dp”
android:shadowColor=”#E91E63″
android:text=”Share”
android:textSize=”18sp”
android:textStyle=”bold”
app:backgroundTint=”#EF598C”
app:strokeColor=”#FFFFFF” />

<LinearLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:layout_marginTop=”30dp”
android:layout_marginBottom=”30dp”
android:background=”@drawable/botamshape”
android:gravity=”center|center_horizontal”
android:orientation=”horizontal”
android:padding=”5dp”>

<ImageView
android:id=”@+id/img1″
android:layout_width=”50dp”
android:layout_height=”50dp”
android:layout_weight=”1″
app:srcCompat=”@drawable/facebook” />

<ImageView
android:id=”@+id/img2″
android:layout_width=”50dp”
android:layout_height=”50dp”
android:layout_weight=”1″
app:srcCompat=”@drawable/instagram” />

<ImageView
android:id=”@+id/img3″
android:layout_width=”50dp”
android:layout_height=”50dp”
android:layout_weight=”1″
app:srcCompat=”@drawable/twitter” />

</LinearLayout>

</LinearLayout>
</LinearLayout>
</ScrollView>

</LinearLayout>




Java code


package com.example.quotes;

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;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

Button share;
TextView quote;
ImageView img1, img2, img3;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();

share = findViewById(R.id.btnshare);
quote = findViewById(R.id.quote);

// fir social share…
img1 = findViewById(R.id.img1);
img2 = findViewById(R.id.img2);
img3 = findViewById(R.id.img3);

share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String sharetxt = quote.getText().toString();
Intent sharingIntent = new Intent();
sharingIntent.setType(“text/plain”);
sharingIntent.putExtra(Intent.EXTRA_TEXT, sharetxt);
startActivity(Intent.createChooser(sharingIntent, “More Options…”));
}
});

img1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String sharetxt = quote.getText().toString();
Intent sharingIntent = new Intent();
sharingIntent.setType(“text/plain”);
sharingIntent.putExtra(Intent.EXTRA_TEXT, sharetxt);
startActivity(Intent.createChooser(sharingIntent, “More Options…”));

}
});

img2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String sharetxt = quote.getText().toString();
Intent sharingIntent = new Intent();
sharingIntent.setType(“text/plain”);
sharingIntent.putExtra(Intent.EXTRA_TEXT, sharetxt);
startActivity(Intent.createChooser(sharingIntent, “More Options…”));

}
});

img3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String sharetxt = quote.getText().toString();
Intent sharingIntent = new Intent();
sharingIntent.setType(“text/plain”);
sharingIntent.putExtra(Intent.EXTRA_TEXT, sharetxt);
startActivity(Intent.createChooser(sharingIntent, “More Options…”));

}
});

}
}



Manifest.xml code
 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.quotes">

<uses-permission android:name=”android.permission.INTERNET” />

<application
android:allowBackup=”true”
android:icon=”@mipmap/ic_launcher”
android:label=”@string/app_name”
android:roundIcon=”@mipmap/ic_launcher”
android:supportsRtl=”true”
android:theme=”@style/Theme.Quotes”>
<activity android:name=”.SplashActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
<activity android:name=”.MainActivity”>

</activity>

<meta-data
android:name=”preloaded_fonts”
android:resource=”@array/preloaded_fonts” />
</application>

</manifest>



Quotes app using android Studio

https://github.com/starkverma111/First-Quotes_app