How are you actually inflating this layout in a View?

This seems to be a normal table layout.  Is there some reason you
can't or don't want to use an xml layout file for this?  See following
example -

http://developer.android.com/guide/topics/ui/layout-objects.html#tablelayout

On Nov 25, 1:00 am, Patrick Plaatje <pplaa...@gmail.com> wrote:
> Hi all,
>
> in my view i have the need to a somewhat different layout. It needs to
> display a table within each row a cell for a thumbnail and a cell for
> displaying a title and a description. The title and description should
> be displayed on top of eachother, so something like:
>
> -----------------------------------------------------------------------------
> |                  |
> title                                                |
> |    thumb     |    description                                     |
> |
> |                                                         |
> -----------------------------------------------------------------------------
>
> In this case i thought i'd use a nested table layout:
>
> TableLayout tl = (TableLayout) findViewById(R.id.maintable);
>
> int i=0;
> for (FeedMessage message : f.getMessages()) {
>         // Create a TableRow and give it an ID
>             TableRow tr = new TableRow(this);
>             tr.setId(i);
>             tr.setBackgroundColor(Color.WHITE);
>             tr.setLayoutParams(new TableLayout.LayoutParams(
>                         TableLayout.LayoutParams.FILL_PARENT,
>                         TableLayout.LayoutParams.FILL_PARENT));
>
>             // setup a new table for the title and the description
> rows
>             TableLayout table = new TableLayout(this);
>             table.setBackgroundColor(Color.WHITE);
>             table.setShrinkAllColumns(true);
>             table.setLayoutParams(new TableRow.LayoutParams(
>                         TableRow.LayoutParams.FILL_PARENT,
>                         TableRow.LayoutParams.FILL_PARENT
>             ));
>
>             // setup the rows for the textviews
>             TableRow titleRow = new TableRow(this);
>             TableRow descriptionRow = new TableRow(this);
>
>             // construct the views
>             TextView titleView = getTitleView(message);
>             TextView descriptionView = getDescriptionView(message);
>             ImageView thumbView = (ImageView) getThumbView(message);
>
>             titleRow.addView(titleView);
>             descriptionRow.addView(descriptionView);
>
>             table.addView(titleRow);
>             table.addView(descriptionRow);
>
>             tr.addView(table);
>             tl.addView(tr);
>
> }
>
> I get no exceptions, messages are real objects, but the table just
> ain't displaying. Any thoughts?
>
> Regards,
>
> Patrick

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to