nUITableElement
com.softwareag.mobile.runtime.nui.nUITableElement
Use to display a table that is composed of
nUITablerowElement and
nUITablecellElement objects.
Usage Notes
Use the
Bgcolor attribute to set the table’s background color. By default, the background color is transparent. To change the color, set the
Bgcolor attribute to an integer that is based on a 32-bit Alpha Red Green Blue (ARGB) format. You can use any solid color. If you specify an Alpha value that is not opaque (0xFF), the behavior of the table object is undefined.
Use the
RelWidths attribute to specify an array of integer values that provide a relative width for each column.
A table occupies the space available from the parent container, minus any padding. The actual pixel width of each column is determined using the following formula:
column_px_width = (table_px_width * column_rel_width) / sum_of_all_rel_widths
Consider the width limitations of the target devices when determining the number of columns to use in a table.
Examples
This code sample creates a table with two equal-width columns.
new nUITableElement(-1, new int [] { 1, 1 });
This code sample uses percentage values to create a table with three columns, where the middle column is twice as wide as the first and last columns. The column percentages should add up to 100%.
new nUITableElement(-1, new int [] { 25, 50, 25 });
This code sample creates a table using
nUITableElement,
nUITableButton,
nUITablerowElement, and
nUITablecellElement. Illustrations of how the example code is rendered on various platforms follows the code sample.
nUITableElement table;
nUITablerowElement tr;
nUITablecellElement tc;
table = new nUITableElement(-1, new int [] { 70, 30 });
{
tr = new nUITablerowElement (-1);
{
tc = new nUITablecellElement (-1);
{
tc.add(new nUITextfieldElement (-1, "Lorem"));
}
tr.add (tc);
tc = new nUITablecellElement (-1);
{
tc.add(new nUITextfieldElement (-1, "ipsum"));
}
tr.add (tc);
}
table.add (tr);
tr = new nUITablerowElement (-1);
{
tc = new nUITablecellElement (-1);
{
tc.add(new nUIButtonElement (-1, "dolor"));
}
tr.add (tc);
tc = new nUITablecellElement (-1);
{
tc.add(new nUIButtonElement (-1, "sit"));
}
tr.add (tc);
}
table.add (tr);
}
view.add(table);
Platform | Illustration |
Android | |
iOS 7 | |
iOS 6 | |
Windows Phone | |
Other | |