Commit a42f40f5 authored by Trio Saputra's avatar Trio Saputra

new updated

parent 6ac0ec6a
...@@ -2,13 +2,39 @@ package com.example.yourcashiertest; ...@@ -2,13 +2,39 @@ package com.example.yourcashiertest;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Spinner;
public class ProductActivity extends AppCompatActivity { public class ProductActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener{
AutoCompleteTextView spCategory;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product); setContentView(R.layout.activity_product);
spCategory = findViewById(R.id.spCategory);
spCategory.setOnItemSelectedListener(this);
ArrayAdapter<CharSequence> arrayAdapter = ArrayAdapter.createFromResource(this, R.array.category,
android.R.layout.simple_spinner_item);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spCategory.setAdapter(arrayAdapter);
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
} }
} }
\ No newline at end of file
...@@ -92,23 +92,27 @@ ...@@ -92,23 +92,27 @@
android:textSize="@dimen/text_default" /> android:textSize="@dimen/text_default" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<Spinner <com.google.android.material.textfield.TextInputLayout
android:id="@+id/spCategory" android:id="@+id/tilCategory"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:listitem="@layout/support_simple_spinner_dropdown_item"
android:layout_below="@+id/tilPrice" android:layout_below="@+id/tilPrice"
android:layout_marginStart="@dimen/space_default" android:layout_marginStart="@dimen/space_default"
android:layout_marginBottom="@dimen/space_default" android:layout_marginBottom="@dimen/space_default"
android:layout_marginEnd="@dimen/space_default" android:layout_marginEnd="@dimen/space_default">
tools:ignore="NotSibling" /> <AutoCompleteTextView
android:id="@+id/spCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilDescription" android:id="@+id/tilDescription"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/spCategory" android:layout_below="@id/tilCategory"
android:layout_marginStart="@dimen/space_default" android:layout_marginStart="@dimen/space_default"
android:layout_marginEnd="@dimen/space_default"> android:layout_marginEnd="@dimen/space_default">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment