如何禁用操作栏选项卡的片段?选项卡、片段、操作

2023-09-12 22:00:00 作者:冷暖自知

由于我使用的操作栏3个标签与碎片A,B,C要禁用B,C最初我使用

As i am using Action bar 3 tabs with fragments A,B,C want to disable B,C initially i am using

    ActionBar.Tab tab2 = ab.newTab();
    tab2.setText("PORT");
    tab2.setTabListener(this);
    tab2.setEnable(false);

而不是允许我使用tab2.setEnable 什么是禁用它确切的方法是什么?

but not allows me to use tab2.setEnable what is exact way to disable it?

推荐答案

您必须从动作条中删除选项卡。启用或不支持disableing标签。也没有可视性功能选项卡。你必须调用:

You have to remove a tab from the actionbar. Enable or disableing tabs is not supported. There is also no visibility function for tabs. You have to call:

ab.removeTab(tab2);

到从动作条中删除选项卡。但是,这并不要求你必须摧毁( TAB2 = NULL )的标签。

to remove a tab from the actionbar. But that does not require that you have to destroy (tab2 = null) your tab.