1

我正在嘗試創建一個android活動轉換,其中活動有一個調用活動b,我需要活動b在被調用時從屏幕右側滑入並滑出右側屏幕被摧毀時,在兩次轉換過程中,我需要活動a保持原位,而不是任何動畫。僅用於被叫活動的Android活動轉換動畫

我已經搜索過這個和所有的動畫,我發現正在做活動的動畫以及我試圖避免這一點,任何幫助將會很長的路要謝謝!

從調用活動目的:

public void searchButtonClick(View view) { 

    Intent intent = new Intent(this, SearchActivity.class); 
    startActivity(intent); 

    overridePendingTransition(R.anim.animate1, R.anim.animate2); 

} 

animate1.xml

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"> 

<translate android:fromXDelta="0%" 
    android:toXDelta="100%" 
    android:duration="@android:integer/config_mediumAnimTime" /> 

</set> 

animate2.xml

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android" 
android:shareInterpolator="false"> 

<translate 
    android:fromXDelta="0%" android:toXDelta="100%" 
    android:fromYDelta="0%" android:toYDelta="0%" 
    android:duration="700" /> 

</set> 
+0

您能分享您的代碼嗎? – Rachit

+0

@快來對不起,我更新了上面的問題 –

回答

0

添加以下行

overridePendingTransition(R.anim.animate1, R.anim.animate2); 

您的onStart()onCreate()SearchActivity.class