用下面的代码动态填充TableLayout,最后显示表格的内容是居左显示的。如何让表格充满屏幕?如何设置动态生成的Textview的字体大小?
TableLayout tbl=(TableLayout) findViewById(R.id.TableLayout1);
for(int i=0; i<10;i++){
TableRow row=new TableRow(this);
for(int j=0;j<13;j++){
TextView txt=new TextView(this); txt.setText(String.valueOf(i)+String.valueOf(j));
row.addView(txt,j);
}
tbl.addView(row);
}
TableLayout tbl=(TableLayout) findViewById(R.id.TableLayout1);
for(int i=0; i<10;i++){
TableRow row=new TableRow(this);
for(int j=0;j<13;j++){
TextView txt=new TextView(this); txt.setText(String.valueOf(i)+String.valueOf(j));
row.addView(txt,j);
}
tbl.addView(row);
}
解决方案 »
- android 4.0如何屏蔽和重写home键。
- android gps location总是null
- 这是怎么回事呢?运行不起来。。。求助~~~
- 毕设想做个android手机软件 求帮助
- Android 如何存储本地图片跟读取图片?
- 有谁知道前段时间特火的嘀嘀打车安卓软件详细的开发教程吗?
- Smartisan OS 状态栏左侧通知如何实现的分类?
- ArcGis的Demo谁有?
- Adroid--app中的缓存是怎样实现的?
- 三年安卓,想要多学一门知识,在纠结学Java后端还是flutte移动跨平台好。
- 谁知道怎么让一个android程序在进程中只启动一个?
- 如何查看SharedPreferences中xml文件的保存路径啊?
mTextView.setTextSize(size);
<TableLayout
android:id="@+id/TableLayout1"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:layout_height="fill_parent"
android:layout_weight="1" >