Reputation: 6954
I am developing an sample application with tab-host,and i have achieved it. And here is my problem? i will describe it in steps.
How can i overcome from this issue?
Upvotes: 1
Views: 1128
Reputation: 1799
You should try this:
FrameLayout frame = tabHost.getTabContentView();
View view1 = frame.getChildAt(pos1);
View view2 = frame.getChildAt(pos2);
frame.removeViewAt(pos1);
frame.addView(view2, pos1);
frame.removeViewAt(pos2);
frame.addView(view1, pos2);
This should switch tab in pos1
position with tab in pos2
position
I have not checked it, but it should work :)
Upvotes: 0
Reputation: 4260
It is strait forward if I understood you correctly
tabHost.setCurrentTab(index)
> EDITS
You can make your tab's invisible
as if you want to invisible tab at position 0 then it is as follow.
tabWidget = (TabWidget) findViewById(android.R.id.tabs);
tabWidget.getChildTabViewAt(0).setVisibility(View.GONE);
If you want make it visible it is as follow
tabWidget.getChildTabViewAt(0).setVisibility(View.VISIBLE);
but if you want to remove old tab and replace it with new. Then I don't know it is possible or not
Upvotes: 1