Question

I am looking to achieve the functionality of an AutocompleteTextView but slightly different. Instead of getting a drop-down list with suggestions i want it to complete the sentence for me.

For example: i type abc and i get completed, with the rest of the text in grey: abc1@etc.etc and then click a button to keep this text or keep writing to filter this even further.

Do you think is is achievable somehow?

I have looked my problem up so far but all the answers i found involved a drop-down list, perhaps i haven't looked deep enough.

Was it helpful?

Solution

Why don't you try to implement a custom view?

Basically, you need to the same things that the AutoCompleteTextView does but instead of displaying N elements into the drop down list you have to add the first option to your EditText.

Have a look at:

  • TextWatcher in order to see how detect the user input and progress

You can then play with indexes and spannables in order to keep track of the data input by the user and the data that you are suggesting.

One thing that I don't like about this idea is the fact that if you have got:

  • Germans
  • Germany
  • ...

You need to type a lot of letters without the possibility to choose something different from the solution that you are providing.

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top