Android Programming Tutorials

(Romina) #1
A Simple Form

android:layout_height="wrap_content"
android:text="Name:"
/>
<EditText android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address:"
/>
<EditText android:id="@+id/addr"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<Button android:id="@+id/save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Save"
/>
</LinearLayout>

This gives us a three-row form: one row with a labeled field for the


restaurant name, one with a labeled field for the restaurant address, and a


big Save button.


Step #3: Compile and Install the Application.....................................


Compile and install the application in the emulator by running the


following commands in your terminal:


ant clean install

Or, from Eclipse, just run the project.


13
Free download pdf