簡體   English   中英

Android Animation 中斷問題

[英]Android Animation Disruption Issue

在一項活動中,我一直在針對以下場景遇到 Rotate animation 問題。 我對我的活動布局有兩種看法。

  1. ImageView
  2. TextView

我為以下操作創建了兩個倒數計時器:

  1. CountDownTimer1:每 1 秒使用txtvw.setText方法將 Textview 文本更新為當前秒數。
  2. CountDownTimer2:每 60 秒執行一次圖像旋轉動畫。

如果禁用CountDowntimer1的setText方法,CountDowntimer2的Rotate animation運行很流暢。 但是當我啟用CountDowntimer1 的 setText 方法時,旋轉 animation 開始斷斷續續/中斷

我在這里做錯了什么? 有任何想法嗎? 謝謝。

查看您的 logcat,您可能會得到口吃/中斷 animation 的原因。您可能會得到類似的聲明

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

這一定是口吃/中斷 animation 的原因,您如何修復它是為了確保您沒有阻塞主線程。

您也可以嘗試<application android:hardwareAccelerated="true"...> 但主要問題是主線程被阻塞了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM