如何在FragmentActivity中overridePendingTransition(int,int)

时间:2014-03-27 13:05:32

标签: android animation

我在ActivityMain类中有一个按钮,它扩展了FragmentActivity。 按下按钮时,我想为下一个活动设置动画。 尝试:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" 
            + appPackageName)));
overridePendingTransition(R.anim.push_down_in,R.anim.push_down_out);

我收到的错误:

"The method overridePendingTransition(int, int) is undefined 
for the type ActivityMain"

如何设置下一个活动的动画?

1 个答案:

答案 0 :(得分:0)

The method overridePendingTransition(int, int) is undefined 
for the type ActivityMain

以上是因为没有为所提到的sdkVersion中的fragmentActivity定义该方法。

将sdk verstion更改为2.0或2.1,它将起作用。

comment

中挑选
I was. Eclipse had automatically picked Android 1.6 as the Project Build Target. 
     

但是在改为2.1后,现在效果很好。   谢啦! - Daniel Jonsson 1月30日和11日20:07