【发布时间】:2014-02-19 14:25:12
【问题描述】:
我有一个片段,它在 onCreateView 中使用 getArguments() 方法来获取一些输入数据。
我将这个片段与 ViewPager 一起使用,它工作正常。
当我尝试在不同的活动中重用这个片段时,问题就开始了,它只显示了这个片段。我想将片段添加到活动的布局中:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment"
android:name="com.example.ScheduleDayFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
问题是:如何将Bundle传递给layout中声明的fragment?
【问题讨论】:
-
谢谢,看来不可能了。
-
为什么需要这样做?
-
我想重用一个使用 Bundle 来显示适当内容的 Fragment