How to hide a tab in Android tab layout?

匿名 (未验证) 提交于 2019-12-03 01:29:01

问题:

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)



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!