Rendy
Rendy

Reputation: 5698

'Block' text in certain format in EditText

Well I don't know how this should be called. Anyone can suggest me on how to do below?

So when user finish to write text in a certain format, the text is 'blocked' and later user can delete whole 'blocked' text instead of each character one by one when they want to.

enter image description here

Upvotes: 2

Views: 233

Answers (2)

matiash
matiash

Reputation: 55350

This is called "Chips". At least according to Roman Nurik in this G+ post.

A growing trend across social and communication-related apps is to afford recipient selection using tokenized auto-completing text fields. This kind of UI is more concise than list-based interfaces, and more visually rich, intuitive (exposes a better mental model), and directly manipulable (manage recipients by touching their token) than comma-separated text fields.

It's basically a heavily customized MultiAutoCompleteTextView. You can get the implementation for it from the repository. An example is in the AOSP Messaging (i.e. SMS) app, check the RecipientsEditor class. Seems quite complex.

Upvotes: 2

kidnan1991
kidnan1991

Reputation: 366

If you want to create many items of this type, you should override the EditText type, then include it into your xml. To identify "user finish to write text in a certain format", add a addTextChangedListener() and when users press "Enter key = finish", you change your edit text layout by wrapping around a shape (define it in drawable/) Also handle when users press "Delete key", set whole text into empty.

Upvotes: 0

Related Questions