You are on page 1of 10

Christine Mae T.

Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
Layout activity_main (XML File)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/bg"
android:orientation="vertical">

<!--CM Loan Bank-->


<TextView
android:id="@+id/tv1"
android:text="@string/cm"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"/>

<!--Loan Application Form-->


<TextView
android:id="@+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/form"
android:textSize="18sp"
android:textStyle="bold"
android:layout_margin="5dp"
android:layout_marginBottom="5dp"
android:layout_centerHorizontal="true"
android:layout_below="@id/tv1"/>

<RelativeLayout
android:id="@+id/r1"
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tv2">

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
android:layout_height="match_parent"
android:layout_marginTop="5dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:drawableLeft="@drawable/ic_baseline_person_24"
android:drawablePadding="10dp"
android:hint="@string/fn"
android:textSize="10dp"
android:inputType="textPersonName" />

<!--Last Name-->

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:drawableLeft="@drawable/ic_baseline_person_24"
android:drawablePadding="10dp"
android:hint="@string/ln"
android:textSize="10dp"
android:inputType="textPersonName" />

<!--Age-->
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:drawableLeft="@drawable/ic_baseline_person_24"
android:drawablePadding="10dp"
android:hint="@string/age"
android:textSize="10dp"
android:inputType="number" />

<!--Address-->

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/add"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="54dp"
android:layout_marginTop="5dp">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:drawableLeft="@drawable/ic_baseline_location_on_24"
android:drawablePadding="10dp"
android:hint="@string/add"
android:textSize="10dp"
android:inputType="textShortMessage" />

</com.google.android.material.textfield.TextInputLayout>

</com.google.android.material.textfield.TextInputLayout>

</com.google.android.material.textfield.TextInputLayout>

</com.google.android.material.textfield.TextInputLayout>

</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
android:layout_marginTop="330dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">

<!--Salary-->
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="10dp"
android:textSize="15dp"
android:text="@string/salary"/>

<com.google.android.material.textfield.TextInputLayout

style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMe
nu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Under Php 10,000">

<AutoCompleteTextView
android:id="@+id/filledexposed"
android:layout_width="match_parent"
android:layout_height="45dp"
android:inputType="none"
android:textSize="10dp"
tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck">

</AutoCompleteTextView>

</com.google.android.material.textfield.TextInputLayout>

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="400dp"
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
android:orientation="horizontal">

<!--Borrow-->
<TextView
android:id="@+id/borrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="10dp"
android:textSize="15dp"
android:text="@string/borrow"/>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="435dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">

<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<RadioButton
android:id="@+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/radioone"
android:onClick="radio_one"/>

<RadioButton
android:id="@+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/radiotwo"
android:onClick="radio_two"/>

<RadioButton
android:id="@+id/radio3"
android:layout_width="wrap_content"
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
android:layout_height="wrap_content"
android:text="@string/radiothree"
android:onClick="radio_three"/>

</RadioGroup>
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="550dp"
android:layout_marginBottom="5dp"
android:gravity="center"
android:orientation="horizontal">

<Button
android:id="@+id/btnOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="@drawable/button1"
android:text="@string/btnOK"
android:textColor="@color/title"
tools:ignore="TouchTargetSizeCheck">

</Button>

<Button
android:id="@+id/btnCLR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/button2"
android:text="@string/btnCLR"
android:textColor="@color/title"
tools:ignore="TouchTargetSizeCheck">

</Button>

</LinearLayout>

</RelativeLayout>
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales

Layout drop_down (XML File)


<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1">

</TextView>

Values strings (XML File)


<resources>
<string name="app_name">MTLabE_CionChristine</string>
<string name="cm">CM LOAN BANK</string>
<string name="form">Loan Application Form</string>
<string name="fn">First Name</string>
<string name="ln">Last Name</string>
<string name="age">Age</string>
<string name="add">Address</string>

<string name="salary">What is your current salary?</string>

<string name="radioone">Php 1,000 package at 8.0% interest 1,000.00</string>


<string name="radiotwo">Php 5,000 package at 11.5% interest 5,000.00</string>
<string name="radiothree">Php10,000 package at 15.0% interest 10,000.00</string>

<string name="borrow">How much do you want to borrow?</string>

<string name="btnOK">SUBMIT</string>
<string name="btnCLR">RESET</string>
</resources>

Values colors (XML File)


<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="actionbar">#ff69b4</color>
<color name="bg">#ffb7c5</color>
<color name="title">#ffe4e1</color>
<color name="clr">#fe4164</color>
</resources>

MainActivity (Java File)

package com.example.mtlabe_cionchristine;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().setIcon(R.drawable.bank);
getSupportActionBar().setBackgroundDrawable(new
ColorDrawable(getResources().getColor(R.color.actionbar)));

String [] type = new String[] {"Under Php 10,000","Php 10,001 to Php 25,000","Php 25,001
to Php 50,000","Over Php 50,001"};
ArrayAdapter<String> adapter=new ArrayAdapter<>(
this,
R.layout.drop_down,
type
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales

);

AutoCompleteTextView autoCompleteTextView=findViewById(R.id.filledexposed);
autoCompleteTextView.setAdapter(adapter);

autoCompleteTextView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l ){
Toast.makeText(MainActivity.this,autoCompleteTextView.getText().toString(),
Toast.LENGTH_SHORT).show();
}
});

}
}
Christine Mae T. Cion
MOBAPLAB
BSCS 3A Prof: Mr. Jefferson A. Costales

Screenshot (Output)

You might also like