【发布时间】:2014-05-28 16:11:25
【问题描述】:
我添加和删除这样的片段:
添加
getSherlockActivity().getSupportFragmentManager()
.beginTransaction()
.setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_top, R.anim.slide_in_top, R.anim.slide_out_bottom)
.add(R.id.fragment_explore, fragment)
.addToBackStack(null)
.commit();
ActivityMain.BACKSTACK_EXPLORE.add(fragment);
移除
Fragment depopFragment = BACKSTACK_EXPLORE.get(BACKSTACK_EXPLORE.size() - 1);
getSupportFragmentManager().beginTransaction()
.setCustomAnimations(R.anim.slide_in_top, R.anim.slide_out_bottom, R.anim.slide_in_bottom, R.anim.slide_out_top)
.remove(depopFragment)
.commit();
BACKSTACK_EXPLORE.remove(depopFragment);
有一个快速的幻灯片动画。片段从底部来,又回到底部。
我的问题是当你按下后退按钮(depop 片段)并且在动画完成之前你触摸出现在后面的活动。
它给了我一个简单的致命信号 11 错误(在三星 Galaxy s3 上更常见)
有什么想法吗?
【问题讨论】:
-
可能与您的问题无关,但将片段(存储上下文)保存在静态容器中是不好的做法。这可能会导致上下文泄漏。
-
Reptification :这只发生在三星 Galaxy s3 (android 4.3) 上,从不在 nexus4(android4.4) 上。这仅在删除片段时发生。只有当“fragment2 above”的删除动画仍在进行时,我才点击“fragment1 behind”
标签: java android android-fragments error-handling actionbarsherlock