[英]Android rotate animation between two activity?
如何在兩個活動之間放置旋轉動畫。當開始活動時,下一個活動以旋轉動畫開始
這是一個關於如何在兩個活動之間進行轉換時添加動畫的教程 。 但是,您不想使用文章中的翻譯動畫,而是使用旋轉動畫。 有關動畫的更多信息,請查看此文檔 。
把這兩件事放在一起,這就是你需要做的。 首先,在您調用開始新活動的地方執行以下操作:
//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>
rotate_in.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值來獲得您想要的內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.