开发者

TabHost method to destroy a tab?

I'm looking for a method to destroy a particular tab and the attached activity that I've started in it and I can't seem to find it in the docs for TabHost or TabWidget. I found this question How to remove tab from TabHost but this doesn't make too much sense to me explained in the way that it is. I have also found this method Removing a tab and the activity (intent) inside of it from a TabHost but it seems far too convoluted to be a proper solution. Is there some method I'm missing that gets rid of the TabWidget view? I'm new to coding so maybe I'm just not understanding these two questions fully.

Thanks in开发者_StackOverflow中文版 advanced.


Below function just clears all the tabs from your TabWidget and you have to create tabs again in requestLayout

public void clearAllTabs() {
  mTabWidget.removeAllViews(
  initTabHost();
  mTabContent.removeAllViews();
  mTabSpecs.clear();
  requestLayout();
  invalidate();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜