》In addition to typing, text fields allow for a variety of other activities, such as text selection (cut, copy, paste) and data look-up via auto-completion.
<EditText android:id="@+id/email_address" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/email_hint" android:inputType="textEmailAddress" />》 If you want to provide suggestions to users as they type, you can use a subclass of
EditText
called
AutoCompleteTextView
. To implement auto-complete, you must specify an
Adapter
that provides the text suggestions. There are several kinds of adapters available, depending on where the data is coming from, such as from a database or an array.
》Tip: If you need to change the checkbox state yourself (such as when loading a savedCheckBoxPreference
), use the setChecked(boolean)
or toggle()
method.