0
wie layout_span setzen, layout_margin dynamisch in Code in Androidwie layout_span setzen, dynamisch in Code layout_margin in android
wie layout_span setzen, layout_margin dynamisch in Code in Androidwie layout_span setzen, dynamisch in Code layout_margin in android
Sie können TableRow.addView()
gegeben mit einer TableRow.LayoutParams
Instanz festgelegt layout_margin:
TableLayout newTable = new TableLayout(DisplayContext);
int rowIndex = 0;
// First Row (3 buttons)
TableRow newRow1 = new TableRow(DisplayContext);
newRow1.addView(new Button(DisplayContext), 0);
newRow1.addView(new Button(DisplayContext), 1);
newRow1.addView(new Button(DisplayContext), 2);
newTable.addView(newRow1, rowIndex++);
// Second Row (2 buttons, last one spans 2 columns)
TableRow newRow2 = new TableRow(DisplayContext);
newRow2.addView(new Button(DisplayContext), 0);
Button newButton = new Button(DisplayContext);
// Create the layout to span two columns
TableRow.LayoutParams params = new TableRow.LayoutParams();
params.span = 2;
newRow2.addView(newButton, 1, params);
newTable.addView(newRow2, rowIndex++);
Dieses Problem war einfach hier gelöst: http://stackoverflow.com/questions/4637233/how-to-set-layout-span-through-code – Derzu