从选项卡的活动中一款Android TabHost更新标签 [英] Update tabs from a tab's activity in a Android TabHost

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

问题描述

我有一个TabActivity和我将有3个或4个标签。

I have a TabActivity and am going to have 3 or 4 tabs.

在塔巴,我想有一个ExpandableListView,这将列出产品。我想TABC充当一种购物车中,可能与自身的ListView控件。

In TabA, I would like to have an ExpandableListView, which will list products. I would like TabC to act as a sort of "shopping cart", probably with a ListView of itself.

有没有办法来从活动的TabHost互动?我希望能够点击塔巴内的按钮,并把它更新和切换到TABC。这可能吗?我能跳的活动,呼吁其父母的方法呢?

Is there a way to interact with the TabHost from the Activity? I would like to be able to click a button inside of TabA and have it update and switch to TabC. Is this possible? Can I get the Tab's activities call its parents methods?

推荐答案

如果你实现你的标签是视图,而不是单独的活动,这将是简单得多,运行速度更快,占用内存更少,并成为一个更好的解决方案恕我直言

If you implement your tabs as views, rather than individual activities, this would be far simpler, run faster, take up less memory, and be a better solution IMHO.

话虽这么说,在Tab A 活动,呼叫的getParent()获得的 TabActivity 。然后,您可以用指出disretrospect的方法。

That being said, in the Tab A Activity, call getParent() to get at the TabActivity. Then, you can use the methods pointed out by disretrospect.

这篇关于从选项卡的活动中一款Android TabHost更新标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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