Android implements page animation switching during Activity jump and finish
Today, when shenyang binzi was working on an APP, the customer's demand was changed by adding an animation switch to the page in the original program, similar to the IPhone's left-out and right-in method, returns the opposite result. I know there are two ways to achieve this. One is to switch the animation by executing the overridePendingTransition method after startActivity, and the same is true for finish. The following is the encapsulated method:
/***** @ Description: The effect of the left-out and right-in jump to the page * @ Method_Name: startActivityAnim * @ param activity * @ return: void * @ Creation Date: 10:20:37 * @ version: v1.00 * @ Author: JiaBin * @ Update Date: * @ Update Author: JiaBin */public static void startActivityAnim (Activity activity, Class
TLS) {Intent intent = new Intent (); intent. setClass (activity, linoleic); activity. startActivity (intent); // set the animation to switch from the right to exit the activity on the left. overridePendingTransition (R. anim. in_from_right, R. anim. out_to_left );}
Then read the original Coder code (a headache ~~~) I found that using my common method can meet the customer's needs, but there will be a lot of changes, which is a headache, so I want to use the second method, through xml configuration, make every one in AndroidManifest. the activities registered in xml are referenced in the configuration so that the customer's results can be achieved and the project can be changed to the minimum extent. The following is a method:
1. declare the following code in style. xml:
2. declare the following code in style. xml:
3. Set and select the theme of every Activity in AndroidManifest. xml that requires this effect. The Code is as follows:
In the preceding three steps, you can switch between the animations that access the jump Activity. The corresponding animation files are attached below.
In_from_right.xml
Out_to_left.xml
Push_left_in.xml
Push_left_out.xml
Push_right_in.xml
Push_right_out.xml
The above is the fragment code that needs to be used. If you need it, you can write the animation effect on your own and then meet your needs.