I have a tab layout containing 3 tabs. I want to add 4th tab at run time and hide this tab after some time. Please let me know how to hide a tab in Android.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Get TabHost
from resource as
TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
Then runtime use this
tabHost.getTabWidget().getChildAt(3).setVisibility(View.GONE);
Supposing that you are trying to hide 4th Tab.(So 3 is used
)