Professional Documents
Culture Documents
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">
<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
</TextView>
<string name="btnOK">SUBMIT</string>
<string name="btnCLR">RESET</string>
</resources>
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;
@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)