Home | Русский

Android – TableLayout Samples

Today’s sample code will implement very similar UI to the one created in the LinearLayout Example. But here we will be using a TableLayout widget instead.

Each TableLayout consists of a number of TableRow objects and each TableRow object contains zero or more cells. Each cell can hold one View object. The table has as many columns as the row with the most cells and cells can of course span columns. Here is a simple example of a “Sign In” form created with the TableLayout container:


< ?xml version="1.0" encoding="utf-8"?>











Notice, that there aren’t specified layout_width and layout_height attributes in the XML file. It’s because TableRow always enforces those values to be respectively fill_parent and wrap_content.

This entry was written by admin , posted on Friday November 21 2008at 07:11 am , filed under Android and tagged , . Bookmark the permalink . Post a comment below or leave a trackback: Trackback URL.

Leave a Reply

You must be logged in to post a comment.