In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to achieve the gradual effect of animation in Android", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to achieve the gradual effect of animation in Android"!
Four android animation effects:
Alpha gradient transparency animation effect
Scale gradient size stretch animation effect
Translate screen shift position moving animation effect
Rotate screen transfer rotation animation effect
The simplest is the gradual transparency effect, which alone can complete the fade-out animation effect (which can be used for the whole welcome page or part of the welcome page):
1) create a new anim folder in res to hold the action files defined by the animation:
Fromalpha is the transparency at the beginning, toalpha is the transparency at the end, and duration is the time (in milliseconds).
2), define the layout file (layout):
This is no different from the past, just id the images that are going to fade away.
3) implementation method (Activity):
Public class WelcomeActivity extends Activity implements AnimationListener {private ImageView imageView = null; private Animation alphaAnimation = null; @ Override public void onCreate (Bundle savedInstanceState) {super.onCreate (savedInstanceState); setContentView (R.layout.activity_welcome); imageView = (ImageView) findViewById (R.id.welcom_logo); alphaAnimation = AnimationUtils.loadAnimation (this, R.anim.welcome_alpha); alphaAnimation.setFillEnabled (true); / / start Fill keep alphaAnimation.setFillAfter (true); / / the last frame of the animation is imageView.setAnimation (alphaAnimation) retained on view AlphaAnimation.setAnimationListener (this);} @ Override public boolean onCreateOptionsMenu (Menu menu) {getMenuInflater () .inflate (R.menu.activity_welcome, menu); return true;} @ Override public void onAnimationEnd (Animation animation) {/ / end the welcome page at the end of the animation and jump to the main page Intent intent=new Intent (this,GroupActivity.class); startActivity (intent); this.finish () } @ Override public void onAnimationRepeat (Animation animation) {} @ Override public void onAnimationStart (Animation animation) {} public boolean onKeyDown (int KeyCode,KeyEvent event) {/ / blocking the BACK key if (KeyCode==KeyEvent.KEYCODE_BACK) {return false;} return false;} on the welcome page so far, I believe you have a deeper understanding of "how to achieve the gradual effect of animation in Android". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.