Override contents of table layout at runtime
I have created a table layout in xml. At runtime, i am using a condition where in first case i am filling table layout. However in second case i am again adding contents to the same layout. And they get added up at the end of lay开发者_StackOverflow中文版out. However i need to clear the previous contents of layout i.e. of first case by contents of second case. Any suggestions ???
Regards
Not sure if it's what you are looking for, but you can use these TableLayout's methods to remove tableRows as needed:
public void removeView (View view)
public void removeViewAt (int index)
public void removeViews (int start, int count)
refer to docs: http://developer.android.com/reference/android/widget/TableLayout.html (these methods are inherited from ViewGroup)
精彩评论