[Android basics] detailed introduction and implementation of animation animation
In front, popupwindow realizes the display of the pop-up menu at the bottom of imitation Tencent News. Animation animation effect is used to realize the display and hiding of the menu. This article will introduce it.
1. Animation animation type
Android animation consists of four types:
In XML
In Javacode
2. Android animation mode
Animation has two main animation modes:
One is tweeted animation
One is frame by frame
3. How to define animation in XML file
The steps are as follows:
① New Android project
② Create a new anim folder in the res directory
③ Create a new my in the anim directory_ Anim.xml (note that the file name is lowercase)
④ In my_ Anim.xml add animation code
4. Android animation parsing -- XML
4.1 alpha gradient transparency animation effect
4.2 scale gradient size scaling animation effect
4.3 translate picture conversion position moving animation effect
4.4 rotate picture transfer rotation animation effect
5. How to use animation effects in XML
6. How to use animation effects in XML
7. Android animation analysis -- Javacode
7.1 AlphaAnimation
① Alphaanimation class object definition
② Alphaanimation class object construction
③ Set animation duration
7.2 ScaleAnimation
① Scaleanimation class object definition
② Scaleanimation class object construction
③ Set animation duration
7.3 TranslateAnimation
① Translateanimation class object definition
② Translateanimation class object construction
③ Set animation duration
7.4 RotateAnimation
① Rotateanimation class object definition
② Rotateanimation class object construction
③ Rotateanimation class object construction
8. How to use animation effects in Java code
Use the method startanimation () inherited from the view parent class to add an animation effect for view or its subclass view, etc
9. Let's have a chestnut
9.1 using XML files
① The renderings are as follows:
② Define animation in an XML file, as mentioned earlier
③ There's nothing to say about the layout of the main interface. It's very simple o (∩ ∩) O
④ The logic code of the main interface mainly controls the animation display
10. Realize frame by frame animation with animation list
The chestnut effect drawing is as follows:
The steps are as follows:
① Add picture material in RES / drawable directory
② Add the animation list frame layout file in the drawable folder
③ The main interface page layout setting is too simple to be repeated
④ The main interface code is as follows:
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.