how to delete table row in table layout in android

前端 未结 8 2323
感动是毒
感动是毒 2021-02-13 01:28
void init()
{
   intcolumnwidth1 = int_scr_wd*55;
   intcolumnwidth1 = intcolumnwidth1/100;
   for (int i = 0; i < strarr.length-1; i++)
   {
      strinarr = fun1.sp         


        
8条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-13 02:10

    This method I have written removes all rows except the first one. It is useful if you don't want to remove the header row, for example:

    private void cleanTable(TableLayout table) {
    
        int childCount = table.getChildCount();
    
        // Remove all rows except the first one
        if (childCount > 1) {
            table.removeViews(1, childCount - 1);
        }
    }
    

提交回复
热议问题