Android MultiAutoCompleteTextView

Download Android MultiAutoCompleteTextView sample

Android MultiAutoCompleteTextView is an editable text view, extending AutoCompleteTextView, that can show completion suggestions for the substring of the text where the user is typing instead of necessarily for the entire thing.

You must provide a MultiAutoCompleteTextView.Tokenizer to distinguish the various substrings.

MultiAutoCompleteTextView xml attributes

Some important xml attributes of Android MultiAutoCompleteTextView are explained as follows:

Xml attributes Description
android:completionHint Specify the hint displayed in the drop down menu.
android:completionHintView Specify the hint view displayed in the drop down menu
android:completionThreshold Specify the number of characters that the user must type before completion suggestions are displayed in a drop down menu
android:dropDownAnchor This is the View to anchor the auto complete dropdown to.
android:dropDownHeight Specify the basic height of the dropdown.
android:dropDownHorizontalOffset The amount of pixels by which the drop down should be offset horizontally
android:dropDownSelector This is the selector in a drop down list
android:dropDownVerticalOffset The amount of pixels by which the drop down should be offset vertically.
android:dropDownWidth This specifies the basic width of the dropdown.

Text decoration in android

Android provides several text decorating attributes like Typeface, font family, text style, text size, text color, text shadow etc. that can be applied to AutoCompleteText. To learn more visit below given link:

How to decorate text in android

How to customize suggestion box of MultiAutoCompleteTextView?

To customize suggestion box, i created a new layout as given below:

When I created adapter to handle AutoCompleteTextView data, I just specified the layout & TextView which I want for suggestion box as follows:


MultiAutoCompleteTextView custum suggestion box

Example of MultiAutoCompleteTextView

In this example, we are going to use demonstrate AutoCompleteTextView with customized suggestion box.


Android MultiAutoCompleteTextView

Step 1: Create a new project in Android Studio and name it Android AutoCompleteTextView.

Step 2: Open res -> layout -> activity_main.xml and add following code


Step 3: Open res -> values -> strings.xml and replace it with below given code.


Step 4: Create a new layout resource under res -> layout named hint_completion_layout.xml. Replace the code of hint_completion_layout.xml with below given code.


Step 5: Open your and replace it's code with below given code of f my as follows:

Step 6: Clean and run the project to see the result.

Share & Like

Tutorial topics

About is for Java, J2ee, Html5 and android developers. All tutorials are well explained and are easy to understand. We have tested every tutorials on our developement environment before posting it in public domain.