動畫布局
回答
其簡單,
創建一個佈局,並在佈局上應用翻譯動畫。在XML使佈局不可見的,在你的代碼,根據烏拉圭回合的需要
<RelativeLayout
android:id="@+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="220dip"
android:orientation="vertical"
android:layout_marginTop="480dip"
>
</RelativeLayout>
Java代碼使其可見
改變這個XML是這樣
Animation movement5;
layout3 = (LinearLayout) findViewById(R.id.linearLayout3);
layout3.setVisibility(true); USE THIS LINE //EDITED
movement5 = AnimationUtils.loadAnimation(this,R.layout.animation_test5);
movement5.reset();
movement5.setfillafter(true);
movement5.setAnimationListener(this);
layout3.startAnimation(movement5);
animation_test5.xml。
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0%" android:toXDelta="0%" android:fromYDelta="-300%"
android:toYDelta="100%" android:duration="3000" android:zAdjustment="normal" />
move.setAnimationListener(this); ...我得到setAnimationListener錯誤..你能告訴我什麼是這個對象 – Keerthiraj
你的活動應該實現AnimationListner – Randroid
但是當我這樣做時,它要求我添加未實現的方法..添加後我應該編輯這些方法.. – Keerthiraj
使用類TranslateAnimation
public TranslateAnimation (float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
在這裏,您可以給來自YDelta和toYDelta的頂部到底部動畫值。然後通過類TranslateAnimation的對象調用方法setDuration(以毫秒爲單位的時間)和setFillAfter(true)。
- 1. 動畫布局
- 2. 動畫與自動佈局
- 3. Android動畫+移動佈局
- 4. 自動佈局和動畫
- 5. 佈局展開動畫
- 6. Android動畫布局訂購
- 7. jQuery框佈局和動畫
- 8. 用動畫更新佈局
- 9. Android動畫線性佈局
- 10. 動畫相關佈局
- 11. 佈局上的Android動畫
- 12. NSCollectionView動畫重新佈局
- 13. 動畫的線性佈局
- 14. 佈局上的動畫?
- 15. FragmentDialog動畫布局關閉
- 16. 佈局動畫Android [Facebook]
- 17. 佈局動畫Android代碼
- 18. 佈局動畫爲空
- 19. Android畫布佈局
- 20. 使用tkinter畫布的畫布佈局
- 21. 浮動佈局中的動畫KIVY
- 22. 自動佈局和嵌套動畫
- 23. 滑出滾動佈局動畫android
- 24. jquery響應式佈局浮動動畫
- 25. UILabel自動佈局高度動畫
- 26. FLEX4列表和佈局拖動動畫
- 27. 動畫不隱含自動佈局
- 28. 動畫效果/下自動佈局
- 29. 在佈局中滑動動畫:android
- 30. 的iOS:自動佈局不與動畫
檢查本http://stackoverflow.com/questions/20374823/android-animate-my-relative-layout-from-bottom-to-top-and-top-to-bottom-using-tr –