Close tab programmatically TabHost

℡╲_俬逩灬. 提交于 2019-12-12 01:21:49

问题


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

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