30.04.2013 Views

Android - CommonsWare

Android - CommonsWare

Android - CommonsWare

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Using Selection Widgets<br />

Figure 27. The same application, scrolled to the bottom of the grid<br />

Fields: Now With 35% Less Typing!<br />

The AutoCompleteTextView is sort of a hybrid between the EditText (field)<br />

and the Spinner. With auto-completion, as the user types, the text is treated<br />

as a prefix filter, comparing the entered text as a prefix against a list of<br />

candidates. Matches are shown in a selection list that, like with Spinner,<br />

folds down from the field. The user can either type out an entry (e.g.,<br />

something not in the list) or choose an entry from the list to be the value of<br />

the field.<br />

AutoCompleteTextView subclasses EditText, so you can configure all the<br />

standard look-and-feel aspects, such as font face and color.<br />

In addition, AutoCompleteTextView has a android:completionThreshold<br />

property, to indicate the minimum number of characters a user must enter<br />

before the list filtering begins.<br />

You can give AutoCompleteTextView an adapter containing the list of<br />

candidate values via setAdapter(). However, since the user could type<br />

91<br />

Subscribe to updates at http://commonsware.com Special Creative Commons BY-SA 3.0 License Edition

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!