问题
How can I close tab in TabHost? (My tab this Activity). When I try:
tabHost.removeViewAt(tabHost.getCurrentTab());
My app crashs.
回答1:
This should work:
tabHost.getTabWidget().removeView(tabHost.getTabWidget().getChildTabViewAt(tab_index));
Where tab_index
is the index of the tab that you want to remove.
来源:https://stackoverflow.com/questions/12587965/close-tab-programmatically-tabhost