本文整理了Java中android.widget.TableLayout.setLayoutParams()
方法的一些代码示例,展示了TableLayout.setLayoutParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableLayout.setLayoutParams()
方法的具体详情如下:
包路径:android.widget.TableLayout
类名称:TableLayout
方法名:setLayoutParams
暂无
代码示例来源:origin: stackoverflow.com
TableLayout table = new TableLayout(context);
table.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
table.setWeightSum(1.0f);
TableRow[] rows = new TableRow[4];
for(int i = 0; i < 4; ++i){
rows[i] = new TableRow(context);
rows[i].setBackgroundResource(R.drawable.images214);
rows[i].setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, 0, 0.25f));
table.addView(rows[i]);
}
LinearLayout l = (LinearLayout) findViewById(R.id.linear);
l.addView(table);
代码示例来源:origin: stackoverflow.com
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//Here you can set up the layoutparameters from your tableview and the rowview.
//Maybe you don't have to modify nothing from the parameters of your tableview so
//you can dismiss it.
TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
//Here were we take the tablelayout from your xml
TableLayout tableLayout = (TableLayout)inflater.inflate(R.layout.tableOfProducts, null);
//Like a told you before, maybe you don't need set the parameters of the tablelayout
//so you can comment next line.
tableLayout.setLayoutParams(this.tableParams);
TableRow tableRow = new TableRow(context);
tableRow.setLayoutParams(this.tableParams);
//Here you have to create and modify the new textview.
TextView textView = new TextView(context);
textView.setLayoutParams(this.rowParams);
tableRow.addView(textView);
tableLayout.addView(tableRow);
代码示例来源:origin: stackoverflow.com
private void setupPage(RelativeLayout mainLayout)
{
TableLayout mainTable = new TableLayout(context);
RelativeLayout.LayoutParams tableLayoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT
);
mainTable.setLayoutParams(tableLayoutParams);
mainTable.setBackgroundResource(R.drawable.rectangle);
//JOB DESCRIPTION title
mainTable.addView(getRowTitle("JOB DESCRIPTION"));
//---- END ----
mainLayout.addView(mainTable);
}
代码示例来源:origin: stackoverflow.com
TableLayout tableContainer = new TableLayout(getApplicationContext());
TableLayout.LayoutParams tab_lp = new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
tableContainer.setLayoutParams(tab_lp);
TableRow row = new TableRow(this);
final TextView tvProduct = new TextView(getApplicationContext());
LinearLayout.LayoutParams lp_l3 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, (LayoutParams.WRAP_CONTENT));
tvProduct.setLayoutParams(lp_l3);
tvProduct.setText(product);
row.addView(tvProduct, new TableRow.LayoutParams(1));
tableContainer.addView(row,new TableLayout.LayoutParams());
linearMain.addView(tableContainer);
代码示例来源:origin: stackoverflow.com
LayoutParams.WRAP_CONTENT);
TableLayout layoutINNER = new TableLayout(MainActivity.this);
layoutINNER.setLayoutParams(params1);
TextView[] tx = new TextView[10];
TableRow[] tr = new TableRow[10];
代码示例来源:origin: stackoverflow.com
TableLayout.LayoutParams tableParams =
new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,
TableLayout.LayoutParams.MATCH_PARENT, 1f);
TableLayout.LayoutParams rowParams =
new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 1f);
TableRow.LayoutParams itemParams =
new TableRow.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT, 1f);
TableLayout tableLayout = new TableLayout(MainActivity.this);
tableLayout.setLayoutParams(tableParams);
tableLayout.setBackgroundColor(0xff7434a6);
for (int row = 0; row < 2; row++) {
TableRow tableRow = new TableRow(MainActivity.this);
tableRow.setLayoutParams(rowParams);
for (int column = 0; column < 2; column++) {
Random color = new Random();
int randomColor =
Color.argb(255, color.nextInt(256),
color.nextInt(256),
color.nextInt(256));
TextView textView = new TextView(MainActivity.this);
textView.setLayoutParams(itemParams);
textView.setBackgroundColor(randomColor);
tableRow.addView(textView);
}
tableLayout.addView(tableRow);
}
代码示例来源:origin: stackoverflow.com
tableLayout.setLayoutParams(tableParams);
tableLayout.setBackgroundColor(Color.WHITE);
代码示例来源:origin: stackoverflow.com
private void displayBoard() {
TableLayout l = (TableLayout) findViewById(R.id.GameGrid);
l.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
for (int y = 0; y < b.height(); y++) {
TableRow r = new TableRow(this);
r.setWeightSum(b.width());
for (int x = 0; x < b.width(); x++) {
BoardSpace s = b.getSpaceAt(x, y);
s.setLayoutParams(new TableRow.LayoutParams(
TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.MATCH_PARENT, 1.0f));
r.addView(s);
}
l.addView(r);
}
}
代码示例来源:origin: stackoverflow.com
// try this
TableLayout tableLayout = (TableLayout)findViewById(R.id.tabContentLayout);
tableLayout.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,TableLayout.LayoutParams.WRAP_CONTENT));
tableLayout.removeAllViews();
for(int i=0;i<rows.length;i++){
Log.d("Rows",rows[i]);
String row = rows[i];
TableRow tableRow = new TableRow(this);
tableRow.setBackgroundResource(R.drawable.cell_shape);
tableRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
final String[] cols = row.split(";");
Log.i(LOG_CLASS, "<<---- Columns count : " + cols.length + " ---->>");
for (int j = 0; j < cols.length; j++) {
final String col = cols[j];
TextView columsView = new TextView(getApplicationContext());
columsView.setBackgroundResource(R.drawable.cell_header);
columsView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
columsView.setTextColor(color.white);
columsView.setTextSize(TypedValue.COMPLEX_UNIT_SP,15);
columsView.setGravity(Gravity.CENTER);
columsView.setText(String.format("%7s", col));
Log.d("Cols", String.format("%7s", col));
tableRow.addView(columsView);
}
tableLayout.addView(tableRow);
}
tableLayout.requestLayout();
代码示例来源:origin: stackoverflow.com
table.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
table.setBackgroundColor(Color.DKGRAY);
代码示例来源:origin: stackoverflow.com
tableView.setLayoutParams( table1 );
if( date.size() == 0 )
代码示例来源:origin: stackoverflow.com
table.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
table.setBackgroundColor(Color.parseColor("#F87907"));
代码示例来源:origin: stackoverflow.com
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.setGravity(Gravity.TOP);
ll.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
TableRow tr = new TableRow(this);
代码示例来源:origin: fire3/sailorcast
p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
p.setMargins(10,0,10,0);
tableLayout.setLayoutParams(p);
tableLayout.setStretchAllColumns(true);
代码示例来源:origin: livroandroid/5ed
tabela.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
内容来源于网络,如有侵权,请联系作者删除!