Android Tab 返回 ActivityGroup
我正在使用 ActivityGroup 作为我的选项卡。
在我的 TabActivity onCreate 中
tabHost = getTabHost();
TabHost.TabSpec tabSpec;
Intent intent;
intent = new Intent(MainActivity.this, FirstActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
tabSpec = tabHost.newTabSpec("tab1");
tabSpec.setContent(intent);
tabHost.addTab(tabSpec);
,我的 FirstActivity 扩展了 ActivityGroup,单击按钮后我将像这样转到 SecondActivity;
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
View view = getLocalActivityManager().startActivity("xyz", intent).getDecorView();
setContentView(view);
当我在 SecondActivity 中时,单击“tab1”后,我无法转到 FirstActivity。我该如何解决这个问题?
I'm using ActivityGroup for my tabs.
In my TabActivity onCreate
tabHost = getTabHost();
TabHost.TabSpec tabSpec;
Intent intent;
intent = new Intent(MainActivity.this, FirstActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
tabSpec = tabHost.newTabSpec("tab1");
tabSpec.setContent(intent);
tabHost.addTab(tabSpec);
And my FirstActivity extends ActivityGroup and after a button click I'm going to SecondActivity like that;
Intent intent = new Intent(FirstActivity.this, SecondActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
View view = getLocalActivityManager().startActivity("xyz", intent).getDecorView();
setContentView(view);
And when I'm in the SecondActivity, after click the "tab1", I can not go to FirstActivity. How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须像这样按活动组启动第一个活动
,然后将 FirstActivity 创建为简单活动,然后启动第二个活动。
还可以尝试此链接
http://developer.android.com/resources/教程/views/hello-tabwidget.html
You have to start first activity by activity group like this
then create FirstActivity as simple activity and then start second activity.
And also try this link
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html