Categories

Archives

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:
HTML:
<body>
<table>
<tr>
<td><input type=”button” value=”Record”></td>
<td><input type=”button” value=”Play”></td>
<td><input type=”button” value=”Stop”></td>
</tr>
<tr>
<td><input type=”button” value=”Pause”></td>
<td><input type=”button” value=”Forward”></td>
<td><input type=”button” value=”Rewind”></td>
</tr>
</table>
</body>

Android:
<?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”
>

<TableRow>
<Button android:id=”@+id/RecordBtn”
[...]