Creating the User Input Interface
The most common input type is the
EditText view, used for free-form text entry. Using an
EditText view, you can provide an onscreen keyboard or let the user choose the physical keyboard (if the device provides one) to enter input.
Creating an EditText view
In Chapter 9, you created a view layout XML file, named
reminder_edit.xml, that contained these lines of code:
The snippet creates an input mechanism on the screen where the user can type a task title. The
EditText view spans the width of the screen and occupies only as much height as it needs. When the view is selected, Android automatically opens the onscreen keyboard to allow user input.
The previous example takes a minimalistic approach, compared to the following
EditText example, which is also present in the
reminder_edit.xml layout file:
<EditText android:id=”@+id/body” android:layout_width=”fill_parent”
This code creates the body description text of the task. The layout width and height are the same as in the
EditText view in the previous example, ...