TableLayout:
By seeing the word ‘Table’ itself we know that Table Layout is used to show views in a table format with rows & columns.
How to add rows in a table layout?
- TableRow is used to add rows in a table layout.
- TableRow is a layout. It will arrange its children horizontally. If the table row parent is not table layout, then it will work like a horizontal linear layout.
- Each TableRow will define a single row in table. (If we create 10 TableRows it will define 10 rows in a table).
How to add columns in a table layout?
- We can use any view to add a column in TableRow.
- We can add multiple columns by adding multiple views in a TableRow.
For instance,
******************************************************************
xml version = "1.0? encoding=" utf-8??>
|
03 | android:layout_width = "fill_parent" |
04 | android:layout_height = "fill_parent" |
05 | android:stretchColumns="1?> |
07 | < TextView android:text = "New" |
08 | android:padding = "3dip" /> |
09 | < TextView android:text = "Ctrl+N" |
10 | android:gravity = "right" |
11 | android:padding = "3dip" /> |
14 | < TextView android:text = "Import" |
15 | android:padding = "3dip" /> |
18 | < TextView android:text = "Exit" |
19 | android:padding = "3dip" /> |
20 | < TextView android:text = "Ctrl+E" |
21 | android:gravity = "right" |
22 | android:padding = "3dip" /> |
******************************************************************
No comments:
Post a Comment