android:从tablelayout中删除一行

android:从tablelayout中删除一行,android,tablelayout,layout-inflater,Android,Tablelayout,Layout Inflater,要在tablelayout中添加行,代码可以按如下方式执行: private void ToDisplayTagGUI(String Slot, int index) LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View newTagView = inflater.inflate(R.layout.new_tag_view,

要在tablelayout中添加行,代码可以按如下方式执行:

   private void ToDisplayTagGUI(String Slot, int index)
      LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View newTagView = inflater.inflate(R.layout.new_tag_view, null);
      SlotTableLayout.addView(newTagView, index);
      SlotTableLayout.removeAllViews();
要删除整个tablelayout的数据,代码可以如下所示:

   private void ToDisplayTagGUI(String Slot, int index)
      LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View newTagView = inflater.inflate(R.layout.new_tag_view, null);
      SlotTableLayout.addView(newTagView, index);
      SlotTableLayout.removeAllViews();

如果我只想从tablelayout中删除其中一行,该如何操作?

要从tablelayout中删除特定行,可以使用:

表.removeView(行索引)