如何在Android中使用TabHost.OnTabChangeListener?
How to use TabHost.OnTabChangeListener in android?
给我一些例如code ...:(
give me some example code... :(
感谢
为什么它会是我的荣幸,以帮助你的好先生:
why it would be my pleasure to help you good sir:
myTabHost.setOnTabChangedListener(new OnTabChangeListener(){
@Override
public void onTabChanged(String tabId) {
if(TAB_1_TAG.equals(tabId)) {
//destroy earth
}
if(TAB_2_TAG.equals(tabId)) {
//destroy mars
}
}});
其中, TAB_1_TAG
是在创建标签时提供给 newTabSpec
方法的标签。
Where TAB_1_TAG
is the tag provided to the newTabSpec
method when creating the tab.