Refine search
TableRow tr = new TableRow(this); TableLayout.LayoutParams tableRowParams= new TableLayout.LayoutParams (TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT); int leftMargin=10; int topMargin=2; int rightMargin=10; int bottomMargin=2; tableRowParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin); tr.setLayoutParams(tableRowParams);
/* Find Tablelayout defined in main.xml */ TableLayout tl = (TableLayout) findViewById(R.id.SaleOrderLines); /* Create a new row to be added. */ TableRow tr = new TableRow(this); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); /* Create a Button to be the row-content. */ Button b = new Button(this); b.setText("Dynamic Button"); b.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); /* Add Button to row. */ tr.addView(b); /* Add row to TableLayout. */ //tr.setBackgroundResource(R.drawable.sf_gradient_03); tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
HSV.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); TableRow tblRow = new TableRow(this); tblRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); tblRow.setBackgroundResource(R.drawable.bookshelf); textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tblRow.addView(imageView,j);
TableRow row1 = new TableRow(this); TableRow.LayoutParams newParams = buildParams(row1); row1.setLayoutParams(newParams);
public void init(){ TableLayout ll = (TableLayout) findViewById(R.id.displayLinear); for (int i = 0; i <2; i++) { TableRow row= new TableRow(this); TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT); row.setLayoutParams(lp); checkBox = new CheckBox(this); tv = new TextView(this); addBtn = new ImageButton(this); addBtn.setImageResource(R.drawable.add); minusBtn = new ImageButton(this); minusBtn.setImageResource(R.drawable.minus); qty = new TextView(this); checkBox.setText("hello"); qty.setText("10"); row.addView(checkBox); row.addView(minusBtn); row.addView(qty); row.addView(addBtn); ll.addView(row,i); } }
TableRow tr = new TableRow(...); TableLayout.LayoutParams lp = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10,10,10,10); tr.setLayoutParams(lp); ------ // the key is here! yourTableLayoutInstance.addView(tr, lp);
for (int i = 0; i < newslist.size(); i++) { TableRow row = new TableRow(this); row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); news1 = (news) newslist.get(i); txtview.setText(new1.getTitle()); System.out.println(new1.getTitle()); row.addView(txtview); tb.addView(row); }
TableRow tr = new TableRow(...); TableLayout.LayoutParams lp = new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10,10,10,10); tr.setLayoutParams(lp); ------ // the key is here! yourTableLayoutInstance.addView(tr, lp);
foreach (news new1 : newslist) { TableRow row = new TableRow(this); row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); txtview.setText(new1.getTitle()); System.out.println(new1.getTitle()); row.addView(txtview); tb.addView(row); }
TableRow tr = new TableRow(this); TableLayout.LayoutParams tableRowParams= new TableLayout.LayoutParams (TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT); int leftMargin=10; int topMargin=2; int rightMargin=10; int bottomMargin=2; tableRowParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin); tr.setLayoutParams(tableRowParams);
for (int j = 0; j < 2; j++) { final String col = cols[j]; columsView[k] = new TextView(this); columsView[k].setText(String.format("%7s", col)); TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); tableRow.addView(columsView[k]); k++; tableLayout.addView(tableRow); }
TableRow tr = new TableRow(this); TableLayout.LayoutParams tableRowParams= new TableLayout.LayoutParams (TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.FILL_PARENT); int leftMargin=10; int topMargin=2; int rightMargin=10; int bottomMargin=2; tableRowParams.setMargins(leftMargin, topMargin, rightMargin, bottomMargin); tr.setLayoutParams(tableRowParams);
public Tablelayout table; public void populateTable(String queryResult){ table = (TableLayout)findviewbyid(R.id.<yourtablename>); TableRow tr = new TableRow(this); tr.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); TextView myDbResult = new TextView(this); myDbResult.setText(queryResult); tr.addView(myDbResult); table.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT)); }
TableRow tr = new TableRow(this); TableLayout.LayoutParams tableRowParams= new TableLayout.LayoutParams (TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.WRAP_CONTENT); tableRowParams.setMargins(10, 10, 10, 10); tr.setLayoutParams(tableRowParams);
for (int i = 0; i < attrName.length; i++) { TableRow tr = new TableRow(this); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); TextView atName = new TextView(this); atName.setText(attrName[i]); atName.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tr.addView(atName); table.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); }
TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new TableLayout.LayoutParams( TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT, 1.0f));
final String row=name+";"+surname; final String[] cols = row.split(";"); for (int j = 0; j < cols.length; j++) { final String col = cols[j]; TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); columsView[k] = new TextView(this); columsView[k].setText(String.format("%7s", col)); tableRow.addView(columsView[k]); k++; tableLayout.addView(tableRow); }
TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new TableLayout.LayoutParams( TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.FILL_PARENT, 1.0f));
TableRow row = new TableRow(this); TableRow.LayoutParams lp = new TableRow.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT); row.setLayoutParams(lp); TextView textView = new TextView(this); textView.setLayoutParams(new TableRow.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT, 1.0f)); textView.setText("yourValue"); row.addView(textView); tablelayout.addView(row);
TableRow tr = new TableRow(this); tr.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));