在使用时,我遇到了这个错误。
getActivity().getSupportFragmentManager()
.beginTransaction()
.setCustomAnimations(
R.animator.card_flip_right_in, R.animator.card_flip_right_out,
R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.content_fragment, new DaysSinceBirthSettingFragment())
.addToBackStack(null)
.commit();
但是当我将它改变为
getActivity().getFragmentManager()
.beginTransaction()
.setCustomAnimations(
R.animator.card_flip_right_in, R.animator.card_flip_right_out,
R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.content_fragment, new DaysSinceBirthSettingFragment())
.addToBackStack(null)
.commit();
它工作得很好,但我需要支持旧版本,所以我必须使用support-v4,其中getSupportFragmentManager()
来自。
我读到一些文章说res/animator
不受support-v4支持,因此我还尝试将我的动画XML文件移动到res/anim
文件夹中,并通过R.anim.card_flip_right_in
引用它。
但仍然无法正常工作,有人能告诉我该怎么办吗?