0

我已经完成TabActivity了这段代码:

addTab(publication, "First", My_Files.class);
addTab(shop, "Second", Others.class); 

private void addTab(String labelId, int drawableId, Class<?> c)
{
    TabHost tabHost = getTabHost();  // The activity TabHost

    Intent intent = new Intent(this, c);
    TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); 

    View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
    TextView title = (TextView) tabIndicator.findViewById(R.id.title);
    title.setText(labelId);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
    icon.setImageResource(drawableId);

    spec.setIndicator(tabIndicator);
    spec.setContent(intent);
    tabHost.addTab(spec);
}

在这些第一个和第二个选项卡中,我有一些上下文,用户按下它并使用以下代码ListView转到其他选项卡:Activity

    Intent intent = new Intent("android.app.reader.FILES");  
    intent.putExtra("publicatonName", "fileName");
    startActivity(intent);

但是我的消失了TabActivity,但我仍然想像 iPhone 一样使用 UITabBarUINavigationController

所以现在我在想,当我去其他地方时,Activity我需要将当前TabActivity按钮类目标更改为当前,并且我Tab Bar Activity应该以某种方式可见。

也许有人可以帮助我。

谢谢。

4

1 回答 1

1

ActivityGroup,它将是您的其他活动的容器。当用户单击其中一个按钮时,您将获得对 LocalActivityManager 的引用,并使用它来启动和嵌入内部活动。从这里获得一些经验

于 2012-02-22T15:02:51.337 回答