TableLayout in Android :

The TableLayout groups views into rows and columns. you use the  <TableRow> component to designate a row within the table. Each row can contain one or more views and each view you place inside a row forms a cell. The width of every column is set by the largest width of each cell in this column. This example shows a way to use the TableLayout in android.

android tablelayout example

Note : This example (Project) is developed in Eclipse Version Kepler, tested on Android 4.4.2 (KitKat Version) and SDK build-tools 22.6.3

Solution Stuff :

In Android use TableLayout is very easy  , TableLayout is arranges components in rows and columns, just like the standard table layout in HTML, <tr> and <td>.

Complete Code :

1. Open “res/layout/activity_main.xml” file and add following XML code.

File : res/layout/activity_main.xml

In this example, we used 4 Rows in TableLayout , First and Second Row have 2 columns. Also how to TableLayout arrange button, TextView and EditText in rows.

Figure shows Android Table Layout example :

Android table layout example

Download Android TableLayout example Source code :

Leave a Reply