简体   繁体   中英

Android Animation Disruption Issue

In a activity I have been having Rotate animation issue for the following scenario. I have two views on my activity layout.

  1. ImageView
  2. TextView

I have created two Countdown-timers for the following operations:

  1. CountDownTimer1: Every 1 second update the Textview text with current second using method txtvw.setText method.
  2. CountDownTimer2: After every 60 seconds perform Image RotateAnimation.

The Rotate animation of CountDowntimer2 runs smoothly if I disable the setText method of CountDowntimer1. But rotate animation starts to stutter/disrupt when I enable the setText method of CountDowntimer1

What wrong am I doing here? Any ideas? Thanks.

Look at your logcat you might get the reason for the stutter/disrupt animation. You might be getting statement like

I/Choreographer: Skipped 37 frames!  The application may be doing too much work on its main thread.

This must be the reason for the stutter/disrupt animation, how you can fix it is to make sure you are not blocking the main thread.

You can try <application android:hardwareAccelerated="true"...> as well. But the main issue is in the main thread getting block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM