[Android] mobile guard UI switching animation, android guard
Create a file tran_out.xml in/res/anim/
Add a <translate> node
Set the X axis source coordinate android: fromXDelta = "0"
Set the x-axis coordinate. android: toXDelte = "-100% p" indicates the entire parent form.
Set Y axis source coordinates android: fromYDelta = "0"
Set the Y axis to android: toYDelta = "0"
Set the execution time android: duration = "500" 500 ms
Create a file tran_in.xml in/res/anim/
Add a <translate> node
Set the x-axis source coordinate android: fromXDelta = "100% p" for the entire parent form
Set the X axis coordinate android: toXDelte = "0"
Set Y axis source coordinates android: fromYDelta = "0"
Set the Y axis to android: toYDelta = "0"
Set the execution time android: duration = "500" 500 ms
On the activity jump page
After startActivity () and finish () Methods
Call the overridePendingTransition () method. Parameter: R. anim. xxx_in, R. anim. yyyyy_out
However, on my simulator, the activity is black screen when it is removed from the left. I haven't found the reason for searching for a long time. It's strange.
Trans_in.xml
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="100%" android:fromYDelta="0" android:toXDelta="0" android:toYDelta="0" ></translate>
Trans_out.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="300" /></set>
Trans_pre_in.xml
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="-100%p" android:fromYDelta="0" android:toXDelta="0" android:toYDelta="0" ></translate>
Trans_pre_out.xml
<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="500" android:fromXDelta="0" android:fromYDelta="0" android:toXDelta="100%p" android:toYDelta="0" ></translate>