TableLayout
16lz
2021-12-04
Android的TableLayout + TableRow虽然使用有点复杂,但是功能很强大
android:collapseColumns:以第0行为序,隐藏指定的列。
android:collapseColumns=0,2--------------意思是把第0和第2列去掉
android:collapseColumns:以第0行为序,隐藏指定的列。
android:collapseColumns=0,2--------------意思是把第0和第2列去掉
TableLayout tableLayout = (TableLayout)findViewById(R.id.TableLayout01); //全部列自动填充空白处 tableLayout.setStretchAllColumns(true); //生成10行,8列的表格 for(int row=0;row<10;row++) { TableRow tableRow=new TableRow(this); for(int col=0;col<8;col++) { //tv用于显示 TextView tv=new TextView(this); tv.setText("("+col+","+row+")"); tableRow.addView(tv); } //新建的TableRow添加到TableLayout tableLayout.addView(tableRow, new TableLayout.LayoutParams(FP, WC)); } }
更多相关文章
- Android(安卓)全屏设置
- android去除ImageButton白色边框
- android设置全屏以及解决设置全屏无效的方法
- Android中利用GridView实现水平和垂直均有滚动条的表格效果
- android去掉系统默认标题栏
- android shape实现边框圆角
- Android中利用GridView实现水平和垂直均有滚动条的表格效果
- Android(安卓)去掉title
- android 设置 dialog位置