View in cells of a table can define its own alignment mode (Gravity). This example describes how to use View in cells in different ways:
<TableLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "wrap_content"
Android: stretchColumns = "1">
<TableRow>
<TextView
Android: layout_column = "1 ″
Android: text = "@ string/table_layout_7_open"
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_7_open_shortcut"
Android: gravity = "right"
Android: padding = "3dip"/>
</TableRow>
<TableRow>
<TextView
Android: layout_column = "1 ″
Android: text = "@ string/table_layout_7_save"
Android: background = "# FF00FF00 ″
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_7_save_shortcut"
Android: gravity = "right"
Android: padding = "3dip"/>
</TableRow>
<TableRow>
<! -Horizontally centers the content of the cell->
<TextView
Android: layout_column = "1 ″
Android: text = "@ string/table_layout_7_save_as"
Android: background = "# FFFF0000 ″
Android: layout_gravity = "center_horizontal"
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_7_save_as_shortcut"
Android: background = "# FFFF00FF"
Android: gravity = "right"
Android: padding = "3dip"/>
</TableRow>
<View
Android: layout_height = "2dip"
Android: background = "# FF909090"/>
<TableRow>
<TextView
Android: text = "@ string/table_layout_7_x"
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_7_import"
Android: padding = "3dip"/>
</TableRow>
<TableRow>
<View
Android: layout_height = "68dip"
Android: background = "# FF909090"/>
<! -Aligns the content of the cell to the bottom right->
<TextView
Android: text = "@ string/table_layout_7_export"
Android: background = "# FFFF0000 ″
Android: layout_gravity = "right | bottom"
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_7_export_shortcut"
Android: background = "# FF00FFFF"
Android: gravity = "right"
Android: padding = "3dip"/>
</TableRow>
<View
Android: layout_height = "2dip"
Android: background = "# FF909090"/>
</TableLayout>