在片段活动启动 [英] Start Activity in a Fragment

查看:171
本文介绍了在片段活动启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开始一个片段的活动,该活动只是像任何其他已安装应用程序。例如。电子邮件。

I want to start an activity in a fragment and the activity is just like any other installed applications. eg. Email.

我从软件包管理系统该应用程序的意图,现在我要开始这项活动,我单独的片段。每当我使用 startActivityFromFragment 是开始于整个屏幕的应用,但我希望启动活动只有片段的限制。

I get the intent of that application from PackageManager, now I want to start that activity in my seperate Fragment. Whenever I use startActivityFromFragment is starts the application in whole screen, but I want to start that activity limited in only that fragment.

我应该怎么办?

推荐答案

放弃这个想法,因为它并没有真正意义,我无法看到它可以做反正

Drop the idea as it doesn't really make sense and I can't see that it can be done anyway.

例如,如果您有双窗格布局,并希望应用程序调用接触到它本身与利用应用程序栏你会怎么指望它看起来沿采用了双面板布局正确的片段?它是正在调用的setContentView并决定如何布​​局自己的,不是你的应用程序中的联系人应用程序。如果我在你的意思是错误的,这是你的活动那么你当然可以创建它片段加载到所需的视图。

For example if you have a dual-pane layout and want to invoke the contacts app into the right fragment which itself uses a dual-pane layout along with making use of the application bar how would you expect it to look? It's the contacts app that is making the call to setContentView and deciding how to layout itself out, not your app. If I'm mistaken in what you mean and it's your activity then of course you can create a fragment from it and load into your required view.

这篇关于在片段活动启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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