Android的:如何从活动使用意图调用片段类意图、片段、Android

2023-09-12 04:48:35 作者:风吹旧夏

我试图调用从活动使用意图片段类。是否有可能实现。请提供您的意见。

I am trying to call a Fragment class from Activity using Intent. Is it possible to implement. Please provide your views.

推荐答案

片段需要举办一个 FragmentActivity ,你可以做一个意图来从活动调用片段。

Fragment needs to be hosting by a FragmentActivity, you can make a Intent to call a fragment from an Activity.

您需要创建一个 FragmentManager 添加您的片段在 FragmentActivity (或调用另一个 FragmentActivity 通过意图并添加您的片段就可以了)。 有关更多信息,请参见本主题:添加一个片段的活动在运行时。

You need to create a FragmentManager to add your fragment in a FragmentActivity (or call another FragmentActivity via an Intent and add your fragment on it). See this topic for more information: Add a Fragment to an Activity at Runtime.

 
精彩推荐
图片推荐