2016-07-01 84 views
0

對於一個項目,我必須逐幀對視頻幀進行一些操作(如視頻上的繪製元素)。有沒有方法可以讓我在Android上逐幀執行操作?Android逐幀方法

回答

0

如果您有框架,您可以使用Android的逐幀動畫技術。

  1. 將圖像(幀)放入可繪製文件夾中。
  2. 創建文件夾繪製,即一個新的文件,frames.xml
  3. 然後把這個代碼在它

<!-- Animation frames are wheel0.png through wheel5.png files inside the res/drawable/ folder --> <animation-list android:id="@+id/selected" android:oneshot="false"> <item android:drawable="@drawable/wheel0" android:duration="50" /> <item android:drawable="@drawable/wheel1" android:duration="50" /> <item android:drawable="@drawable/wheel2" android:duration="50" /> <item android:drawable="@drawable/wheel3" android:duration="50" /> <item android:drawable="@drawable/wheel4" android:duration="50" /> <item android:drawable="@drawable/wheel5" android:duration="50" /> </animation-list>

  • 使用的ImageView玩這些框架。

    ImageView img =(ImageView)findViewById(R.id.spinning_wheel_image); img.setBackgroundResource(R.drawable.spin_animation); AnimationDrawable frameAnimation =(AnimationDrawable)img.getBackground();

    //開始動畫(默認循環播放)。 frameAnimation.start();

  • 參考。

    https://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

    +0

    不行,我必須做一個REST請求視頻的每一幀視頻運行時 – Quarillion