我在使用以下命令时遇到此错误
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();
它工作得很完美。但是我需要支持旧版本,所以我必须使用getSupportFragmentManager()
的support-v4。
我看过一些文章说support-v4不支持res/animator
,所以我也试着把我的动画XML文件移到res/anim
文件夹中,并通过R.anim.card_flip_right_in
引用它
但是它仍然不起作用,有人能告诉我我能做什么吗?
发布于 2013-10-06 07:12:55
支持片段管理器不支持动画师(仅支持动画)。异常消息指出您的xml资源中存在错误的动画格式,这可能是因为您将animator移到了这个错误的xml (因为它们具有不同的符号)。您需要以适当的方式编写它:http://developer.android.com/guide/topics/graphics/view-animation.html
https://stackoverflow.com/questions/19008808
复制相似问题