【发布时间】:2012-01-04 07:48:36
【问题描述】:
我有一个使用这个 XML 调用 setContentView 的 Activity:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
>
<fragment android:name="org.vt.indiatab.GroupFragment"
android:id="@+id/home_groups"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<..some other fragments ...>
</LinearLayout>
GroupFragment 扩展了 Fragment,一切正常。但是,我从 GroupFragment 中显示了一个 DialogFragment。这显示正确,但是当屏幕旋转时,我得到一个强制关闭。
在 DialogFragment.show(FragmentManager, String) 之外的另一个 Fragment 中显示 DialogFragment 的正确方法是什么?
【问题讨论】:
-
你能提供强制关闭的堆栈跟踪吗?
-
您可以发布您实例化 DialogFragment 的代码行吗?