Time for action - creating a contact editor

This example requires that some of the user interface elements are declared out-of-order (as discussed earlier). We'll also include Save and Cancel Button widgets at the bottom of the screen. This example goes back to declaring the user interface in a resource XML file rather than writing it in Java code. For this example, you'll need a placeholder image for the user's contact photo. A 64 x 64 pixel PNG file is about the right size to work with (I used a big smiley image).

  1. Start by creating a new XML layout file named res/layout/relative_layout.xml. Open this file in your editor or IDE.
  2. Declare the root element as a full-screen RelativeLayout:
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" ...

Get Android User Interface Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.