Friday, September 2, 2011

[android-developers] How to close a single tab in tablayout

There is a method to add a tab in TabHost as well as clear all tabs,
but there are no APIs to remove one single tab.

Following the logic in clearAllTabs tried to
tabwidget.removeViewAt(index);
tabHost.getTabContentView().removeViewAt(index)

After this the behaviour is strange. I assume that is because the
mTabSpecs still contain the tabspec reference. mTabSpecs is a private
variable in TabHost and there are not get methods to get a handle to
this.

How to resolve the issue if one wants to close a single tab, and yes i
have tried to clear all the tabs and add back all the tabspecs. It
does not work for my usecase where some views contains some
information regarding a session. If i recreate those tabspecs, i will
go back to the starting point in those views.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment