how to disable a tab in android screen?

前端 未结 2 1266
鱼传尺愫
鱼传尺愫 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

    If you mean to disable one tab button on TabWidget, then try this code:

    // tabHost = ... (get TabHost)
    tabHost.getTabWidget().getChildTabViewAt(your_index).setEnabled(false);
    

    If you want to disable tab widget in overall, then:

    // tabWidget = ... (get TabWidget)    
    tabWidget.setEnabled(false);
    

    Read SDK Help for references:

    • TabHost
    • TabWidget

提交回复
热议问题