在选项卡视图中启动第二个活动
我的问题是这样的:
我有 3 个选项卡,每个选项卡都有指定的活动。从其中一个活动中,我想在第一个活动的视图中启动第二个活动(从而保持选项卡视图可见)。
到目前为止,我已经尝试了几种方法:
1 - 将意图添加到第一个活动的类中,然后调用 startActivityForResult()。这会导致选项卡视图丢失并且第二个活动覆盖屏幕。
2 - 使用 ViewFlipper 并将第二个活动添加为翻转视图。
如果有人可以就我应该在哪里寻找提供任何指导,我将非常高兴:)
谢谢
My problem is this:
I have 3 tabs, each with an assigned activity. From one of those activities, I want to launch a second activity in the first activity's view (thereby keeping the tabview visible).
So far, I have tried a few approaches:
1 - adding an intent to the first activity's class and then calling startActivityForResult(). This results in the tabview being lost and the second activity covering the screen.
2 - Using a ViewFlipper and adding the second activity as the flipped view.
If anyone can give any sort of direction on where I should be looking I will be extremely pleased :)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
约翰,您正在寻找的是 ActivityGroup,这里的链接可能对您有用
http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities
http://ericharlow.blogspot.com/2010/09/experience-multiple -android-activities.html
John all you are looking for is ActivityGroup here are the links that may prove useful to you
http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities
http://ericharlow.blogspot.com/2010/09/experience-multiple-android-activities.html
使用 THis 启动新的 Activity
View view = getLocalActivityManager().startActivity("tab1", new Intent(this,tab1.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
设置内容视图(视图);
Use THis to start the new Activity
View view = getLocalActivityManager().startActivity("tab1", new Intent(this,tab1.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
setContentView(view);