开发者

TabHost method to destroy a tab?

开发者 https://www.devze.com 2023-03-14 02:45 出处:网络
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

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

精彩评论

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