I have an edittext which gets values from the user. I want to add an option which allows the user to choose from different options via drop down list when edittext is clicked. Does anyone have an idea how to do this?
This is edittext code:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/dish_quantity"
android:layout_below="@+id/dish_name"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Quantity" />
I want it to look like this:
I think this is your requirement:
just follow this example: Xml:-
Activity:-
Demo:-
activity_main.xml
MainActivity.java
On Android it`s called autocompletetextview
Official Google doc: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
Please check this out,tutorial http://www.tutorialspoint.com/android/android_auto_complete.htm
I think what you are looking for can be done with a Spinner instead of an EditText.
Here's a detailed explanation of how to use it.