【发布时间】:2014-11-10 18:16:11
【问题描述】:
我有一个片段,我想在打开时向左滑动,在关闭时向右滑动。显示部分工作正常,但是当我们关闭它时,如果我使用 hide(),它可以工作,但我想删除片段,以便它不会在配置更改等时显示,但是当 remove() 时,用于隐藏的相同动画不起作用叫做。请参阅下面的代码。
此代码有效,意味着它显示面板转到正确的动画
Fragment fragment = getFragmentManager().findFragmentByTag(Tags.PANEL_FRAGMENT_TAG.name());
if (fragment != null) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_right);
transaction.hide(fragment);
transaction.commit();
}
此代码不起作用..任何指针?如何删除片段和动画仍然有效..
Fragment fragment = getFragmentManager().findFragmentByTag(Tags.PANEL_FRAGMENT_TAG.name());
if (fragment != null) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_right);
**transaction.remove(fragment);**
transaction.commit();
}
【问题讨论】:
标签: android animation android-fragments android-animation