用下面的代码动态填充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);
}
解决方案 »
- Andriod调用SQLite数据库的问题
- 谷歌公开安卓源码对他有什么好处?
- 关于PreferenceActivity中EditTextPreference的使用
- Barnacle Wifi Tether 有人研究过吗?
- 下的源码MK项目怎么打开
- andriod的配置问题
- 如何通过一个按钮画出一个正方形显示在当前画面
- android jni初学者纠结问题,急急急!!!!!
- !!!空指针问题!!!求助!!!
- Android客户端用Socket给PC端的服务器发消息,为什么有线网的时候可以用,到CMCCEDU的WIFI就不行了呢?
- 谁知道怎么让一个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" >