Android animation practice conclusion

Source: Internet
Author: User

Android animation practice conclusion

Practice:

1. Pan Animation

overridePendingTransition(R.anim.enterAnim,R.anim.exitAnim);

In the method, the first parameter indicates entering enterAnim, and the second parameter indicates exitAnim. How can this problem be solved?

For example, if I write such an effect, it will be the same as on Netease news. When you click a piece of news, it seems that the current page does not move, and then the requested news page gradually translates from right to left and completely hides (overwrites) the current page. If you implement it, see the XML code:

/**  enterAnim  */
 
     
  
 
/** exitAnim  */
 
     
  
 

Then, when you want to jump to another page, place the above method in startActivity (Intent intent.
You will know the effect after running it. The so-called "in" is equivalent to the page that you do not want to see currently. We need to make it disappear; on the contrary, "out" is to make the new page you want to see appear and hide (overwrite) the current page;

When you click back, the effect of the application is the opposite to that of the previous one. effect: the current page is removed from the right, and the original page is displayed under the current page.

Of course, the above method is used. The XML Code is as follows;

/** enterAnim  */
 
                 
   
 
/** exitAnim  */
 
                 
  
 

Usage:

overridePendingTransition(R.anim.enterAnim,R.anim.exitAnim);


The idea is the opposite of that of the request;

In fact, translation is equivalent to a river. First, you must know which direction the river wants to go.

For example, to left: set the first parameter of the method (so that the current page is translated to left) to move from right to left, followed by the request page (second parameter) it is also translated from right to left in the same direction. In this way, the mobility of translation can be realized;

To be continued ....





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.