1)TableLayout
2)TableRow
private String viewData[][] =new String[][]{
{"ID","姓名","公司","地址","电话"},{"Bigdachun","李世春","上海宝智科技","上海陆家嘴","134020*****"},
{"Richard","浪子","上海报纸科技","上海陆家嘴","021-58633xxx"}
TableLayout layout = new TableLayout(this);
TableLayout.LayoutParams params = new TableLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
for(int i =0; i<this.viewData.length;i++)
{
TableRow row = new TableRow(this);
for(int y=0; y<this.viewData[i].length;y++)
{
TextView text = new TextView(this);
if(i!=0)
text.setTextSize(10);
text.setText(this.viewData[i][y]);
row.addView(text,y);
}
layout.addView(row);
}
super.addContentView(layout, params);
Android布局第二天
最新推荐文章于 2022-01-20 15:18:21 发布