`
sbl2255
  • 浏览: 213712 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

TableLayout

阅读更多
Android的TableLayout + TableRow虽然使用有点复杂,但是功能很强大
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));   
        }   
    } 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics