我需要在我的項目中實現動畫, 將視圖從左下角移動到右下角。同時另一個視圖需要從屏幕的上方到中心,如何可以我使用Object動畫實現它。Android中的對象動畫
0
A
回答
0
如果這就是你想要實現的全部(只是移動視圖),那麼你可以用幾行代碼來做到這一點,而不使用xmls。讓我們舉例說100像素向右移動一個按鈕。
// Get the view
TranslateAnimation slideRight = new TranslateAnimation(0, 200f, 0, 0);
// logoutButton is the view that is to be animated
logoutButton.setAnimation(slideRight);
// or
logoutButton.startAnimation(slideRight); // to immediately start the animation
0
您可以創建動畫的XML文件,並加載它們對你的看法。 參考view animation。 動畫XML文件:
<set android:shareInterpolator="false">
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="1.4"
android:fromYScale="1.0"
android:toYScale="0.6"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="700" />
<set android:interpolator="@android:anim/decelerate_interpolator">
<scale
android:fromXScale="1.4"
android:toXScale="0.0"
android:fromYScale="0.6"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400"
android:fillBefore="false" />
<rotate
android:fromDegrees="0"
android:toDegrees="-45"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400" />
</set>
</set>
負載的動畫你的意見
ImageView spaceshipImage = (ImageView) findViewById(R.id.spaceshipImage);
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump);
spaceshipImage.startAnimation(hyperspaceJumpAnimation);
1
相關問題
- 1. Android中的對象的動畫/拖動
- 2. 動畫對象的畫布
- 3. 對象動畫
- 4. android對象動畫過渡和alpahn
- 5. Android如何按順序動畫對象
- 6. 對象動畫 - c4framework
- 7. 與動畫對象
- 8. VBA動畫對象
- 9. 對象的無盡動畫
- 10. 使用Storyboard動畫3D對象動畫
- 11. 追加繪畫對象android
- 12. 當動畫在android中完成時獲取對象的位置
- 13. 在Android中動態更改繪畫對象的顏色
- 14. 在Android中用於過渡的自定義動畫對象?
- 15. 動畫React Native中的對象數組
- 16. Sprite對象中的Cocos2d動畫
- 17. 畫布移動圈中的對象
- 18. 觸摸補間動畫中的對象?
- 19. 活動中的各種繪畫對象
- 20. 發佈動畫中的對象(Unity)
- 21. CSS3動畫動畫它之前的對象是在視口中
- 22. 動畫片段中的畫布對象來自活動
- 23. 如何在動畫中改變對象的動畫?
- 24. 對android中的imageView動畫效果
- 25. 動畫繪製對象
- 26. 動畫導入SVG對象
- 27. Unity對象和動畫
- 28. 需要動畫對象
- 29. jquery動畫Flash對象
- 30. 動畫爲子對象
看看這個:http://developer.android.com/training/animation/zoom.html –