Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android MultiAutoCompleteTextView - displaying custom views in it

I'm implementing MultiAutoCompleteTextView with email contact suggestions. What i want to have is to display contact badges in the MultiAutoCompleteTextView content instead of strings. The Gmail Android app does it. Basically I Want what is shown in the drop down to be shown in the MultiAutoCompleteTextView (contact photo, name and email) after i typed in/selected the contact. Is it possible?

SSchot

like image 461
cubesoft Avatar asked Apr 12 '13 14:04

cubesoft


1 Answers

Google does this via using a custom ImageSpan. I just implemented this successfully for one of my apps. You should look at RecipientEditTextView.java to see how they do it. Essentially they create a drawable via Canvas and assign that drawable to a custom ImageSpan. I cannot post any code since ... well there is a ton, however you should get a good idea looking thru the source.

like image 93
Maurycy Avatar answered Sep 27 '22 18:09

Maurycy