Android Programming Tutorials

(Romina) #1

TUTORIAL 3


A Fancier Form


In this tutorial, we will switch to using a TableLayout for our restaurant data


entry form, plus add a set of radio buttons to represent the type of


restaurant.


Step-By-Step Instructions...........................................................................


First, you need to have completed the previous tutorial. If you are


beginning the tutorials here, or if you wish to not use your existing work,


you can download a ZIP file with all of the tutorial results, and you can copy


the 02-SimpleForm edition of LunchList to use as a starting point.


Step #1: Switch to a TableLayout.........................................................


First, open LunchList/res/layout/main.xml and modify its contents to look


like the following:


<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
>
<TableRow>
<TextView android:text="Name:" />
<EditText android:id="@+id/name" />
</TableRow>
<TableRow>

19
Free download pdf