/**
     * 嵌套fragment时必须要重写 onDetach()如下
     */

    @Override
public void onDetach()
{
super.onDetach();
try
{
Field childFragmentManager = Fragment.class.getDeclaredField("mChildFragmentManager");
childFragmentManager.setAccessible(true);
childFragmentManager.set(this, null); } catch (NoSuchFieldException e)
{
throw new RuntimeException(e);
} catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
}
04-14 19:20