how to disable a tab in android screen?

前端 未结 2 1265
鱼传尺愫
鱼传尺愫 2020-12-05 14:03

hi can you tell me how to disable a tab in the UI of android code.. (eclair code)

2条回答
  •  执念已碎
    2020-12-05 14:32

    Extend TabHost and override methods:

    @Override
    public void setCurrentTab(int currentTab) {
        if (currentTab != 2)  // position of the tab that should not get selected
            super.setCurrentTab(currentTab);
        else
            // in my case I want to trigger something here but I don't want the button to get selected
    }
    
    @Override
    public void setCurrentTabByTag(String tag) {
        if (!"\"plus_tab\"".equals(tag))  // tag of the tab that should not get selected
            super.setCurrentTabByTag(tag);
        else
            // in my case I want to trigger something here but I don't want the button to get selected
    }
    

提交回复
热议问题