Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android在两个活动之间旋转动画?_Android - Fatal编程技术网

Android在两个活动之间旋转动画?

Android在两个活动之间旋转动画?,android,Android,如何在两个活动之间放置旋转动画。何时为startactivity,何时为下一个活动以旋转动画开始。但是,与本文中使用的平移动画不同,您需要使用旋转动画。有关动画的详细信息,请签出此 把这两件事放在一起,下面是你需要做的。首先,在您呼叫启动新活动的位置,请执行以下操作: //Calls a new Activity startActivity(new Intent(this, NewActivity.class)); //Set the transition -> method a

如何在两个活动之间放置旋转动画。何时为startactivity,何时为下一个活动以旋转动画开始。但是,与本文中使用的平移动画不同,您需要使用旋转动画。有关动画的详细信息,请签出此

把这两件事放在一起,下面是你需要做的。首先,在您呼叫启动新活动的位置,请执行以下操作:

//Calls a new Activity  
startActivity(new Intent(this, NewActivity.class));  

//Set the transition -> method available from Android 2.0 and beyond  
overridePendingTransition(R.anim.rotate_out,R.anim.rotate_in);
然后在xml中创建以下两个动画:

rotate_out.xml

<?xml version="1.0" encoding="utf-8"?>   
<set xmlns:android="http://schemas.android.com/apk/res/android">  
   <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="300" />  
   <rotate android:fromDegrees="0" android:toDegrees="90" android:pivotX="25%" />
</set>

在.xml中旋转

<?xml version="1.0" encoding="utf-8"?>   
<set xmlns:android="http://schemas.android.com/apk/res/android">  
   <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="300" />  
   <rotate android:fromDegrees="90" android:toDegrees="0" android:pivotX="-25%" />
</set>


你可以玩fromDegrees,toDegrees,和pivotX值,以获得您想要的结果。

@Ankit:您找到解决方案了吗?是的,我使用Rotate animation3D…请参见android api中的演示@Samir Mangroliya:上述解决方案是否如您所愿工作?这是一个。@|#12d以下解决方案如您所愿工作?我将持续时间从“300”更改为“3000”只是为了清楚地检查实际动画。当我点击按钮从ActivityA转到ActivityB时,屏幕变黑,然后慢慢地ActivityA出现,然后ActivityB出现这并不像我预期的那样工作,,,,Archie是ryt,,,这就是它的显示方式,,,我们如何在从一个活动转到另一个活动时显示翻转,,,