Amazon Gift Cards

Monday, December 29, 2008

Simple TableLayout in Android

First of our Containers Example on android is TableLayout, coming from Web development background, TableLayout is probably the easiest to understand. TableLayout in android is the same as table tag on HTML. Here is an example of it:

        <td><input type="button" value="Record"></td>
        <td><input type="button" value="Play"></td>
        <td><input type="button" value="Stop"></td>
        <td><input type="button" value="Pause"></td>
        <td><input type="button" value="Forward"></td>
        <td><input type="button" value="Rewind"></td>

<xml version="1.0" encoding="utf-8"?>
        <Button android:id="@+id/RecordBtn"
            android:text="Record" />
        <Button android:id="@+id/PlayBtn"
            android:text="Play" />
        <Button android:id="@+id/StopBtn"
            android:text="Stop" />
        <Button android:id="@+id/PauseBtn" 
            android:text="Pause" />
        <Button android:id="@+id/Forward"
            android:text="Forward" />
        <Button android:id="@+id/Rewind" 
            android:text="Rewind" />

If you know html then by now you know that there is no td and instead we use one of the the views/components in android.
This the most basic example of tableLayout, in the future post we shall tackle on some of its properties.

Hope it helps :)

Update History
   Jan 17, 2012 - Visual Update

No comments: