Get all TableRow's in a TableLayout

前端 未结 5 919
春和景丽
春和景丽 2021-02-01 16:10

I\'ve been looking for hours on how to get all TableRow\'s in a TableLayout. I already know how to add and delete rows dynamically, but I need to loop over all the rows and sele

5条回答
  •  独厮守ぢ
    2021-02-01 16:38

    for(int i = 0, j < table.getChildCount(); i < j; i++){
        // then, you can remove the the row you want...
        // for instance...
        TableRow row = (TableRow) table.getChildAt(i);
        if( something you want to check ) {
            removeViewAt(i);
            // or...
            removeView(row);
        }
    }
    

提交回复
热议问题