我使用android.view
包創建了一些圖像和電影應用程序。現在我想爲Android平板電腦創建相同的內容。如何使用「android.animation」包爲平板電腦創建基本的圖像動畫
我看到我可以使用android.animation
包的Android 3.0,但我找不到任何文檔應用淡入淡出,使用此包的縮放效果。我正試圖將這個包中的所有源代碼進行轉換。
如何使用ValueAnimator
和ObjectAnimator
?在Api Demo中,我發現這個代碼片段用於淡入淡出。但是,我如何分配Alpha值?在view.animation
,我不得不fromAlpha, toAlpha...
ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f);
fadeAnim.setDuration(250);
fadeAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
balls.remove(((ObjectAnimator)animation).getTarget());
}
});
再次我有這樣一段代碼:
ValueAnimator anim = ValueAnimator.ofFloat(0f, 1f);
anim.setDuration(500);
anim.start();
什麼時候使用ValuAnimator
,當我使用ObjectAnimator
?