This paper realizes the translation animation between the following several interfaces
Analysis:
Translation animation during the Navigation interface movement
Previous page Move animation (-screen width, y)------> (0,y)
Prev-Move animation (0,y)--------------> (screen width, y)
Next page Move animation (screen width, y)--------------> (0,y)
Next move out animation (0,y)--------------> (-screen width, y)
Create a new Anima folder under the Res folder, and create a new four translate.xml type of file under the folder
The relevant code is as follows:
Pre_in_anim.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<!---100%p minus one screen width size value-->
xmlns: Android= "http://schemas.android.com/apk/res/android"
android:fromxdelta= " -100%p"
android:toxdelta= "0"
android:duration= >
</translate>
Pre_out_anim.xml
<?xml version= "1.0" encoding= "Utf-8"?> <translate xmlns:android=
"http://schemas.android.com/apk" /res/android "
android:fromxdelta=" 0 "
android:toxdelta=" 100%p "
android:duration=" >
</ Translate>
Next_in_anim.xml
<?xml version= "1.0" encoding= "Utf-8"?> <translate xmlns:android=
"http://schemas.android.com/" Apk/res/android "
android:fromxdelta=" 100%p "
android:toxdelta=" 0 "
android:duration=" >
</translate>
Next_out_anim.xml
<?xml version= "1.0" encoding= "Utf-8"?> <translate xmlns:android=
"http://schemas.android.com/" Apk/res/android "
android:fromxdelta=" 0 "
android:toxdelta=" -100%p "
android:duration=" >
</translate>
Then add the following code to the button click event in the 4-interface code
Add in the Prepage button:
Overridependingtransition (R.anim.pre_in_anim, R.anim.pre_out_anim);
Add in the NextPage button:
Overridependingtransition (R.anim.next_in_anim, R.anim.next_out_anim);
The above is a small series to introduce the Android mobile phone guardian to achieve translation animation, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!