Android uses animation to gradually darken the background
preface
Previously, I wrote an article on Android - realizing the pop-up window at the bottom and gradually darkening the background, introducing the use of handler to dynamically change the background transparency to achieve the effect of darkening. Now add a method to use animation to achieve the same effect.
Valueanimator and interpolator
Today's protagonists are these two. Please supplement the concepts of valueanimator and interpolator. Here is how to use us (because I don't understand (covering my face)).
effect
It's not much different from before, just to demonstrate the process of darkening and brightening ↓
code
AnimUtil.java
MainActivity.java
The code is very simple, and the comments are written.
Summary:
Compared with the previous method written by handler, the code is simpler and easier to use in many places. It can also be regarded as filling the pit, ha ha. If another pit is buried in this article, please correct it. Thank you!
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.