O'Reilly logo

Android User Interface Development by Jason Morris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - adding more buttons

We have two additional buttons to add to the screen layout. One will allow the user to skip the current question; the other will allow them to look at the short list of meals that we have filtered through so far (based on the questions they have already answered).

  1. Start by creating an empty<Button /> element below our answers ViewGroup <LinearLayout /> (but still within the root LinearLayout element). Assign it the ID skip, so that we can reference it in Java:
    android:id="@+id/skip"
    
  2. Create some padding between the answers and the new button by using a margin:
    android:layout_marginTop="12sp"
    
  3. Give it the display label Skip Question:
    android:text="Skip Question"
    
  4. Like all of the previous widgets, the width should ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required