如何禁用Android的选项卡内的活动标签 [英] How to disable tabs from the activities inside the tabs in Android

查看:82
本文介绍了如何禁用Android的选项卡内的活动标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序有一个TabActivity其中包含4个选项卡。每个标签都包含了相应的活动。

My application has a TabActivity which contains 4 tabs. Each tab contains the corresponding activities.

在第一个选项卡中的活动是引导活动。根据某些条件下我必须启用/禁用这项活动的其他3个标签。

The activity in the first tab is the Boot Activity. Based on some conditions I have to enable/disable the other 3 tabs from this Activity.

可从活动的启用/禁用选项卡中的选项卡里面谁能帮助?

Can anyone help in enabling/disabling tabs from activities inside the tab?

推荐答案

我觉得你是在谈论隐藏选项卡。
然后使用以下

I think you are talking about hiding a tab.
Then use the following

获取 TabHost 从资源作为

TabHost  tabHost = (TabHost)findViewById(android.R.id.tabhost);

然后运行时使用该

tabHost.getTabWidget().getChildAt(3).setVisibility(View.GONE);

假设你正在试图隐藏第四选项卡。(所以3时)

Supposing that you are trying to hide 4th Tab.(So 3 is used)

这篇关于如何禁用Android的选项卡内的活动标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆