2011-03-15 48 views
0

是否存在與Android的loadAnimation函數相當的XML?我想指定要應用於我的佈局XML中的視圖的動畫。Android的loadAnimation的XML等價物

我有一個動畫資源定義動畫:

<?xml version="1.0" encoding="utf-8"?> 
<rotate 
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:fromDegrees="0" 
    android:toDegrees="359" 
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:duration="10000" 
    android:repeatCount="infinite" /> 

我怎樣才能做到以下在我的佈局XML?

ImageButton main_button = (ImageButton)this.findViewById(R.id.imageButton1); 
    Animation rotateAnimation = AnimationUtils.loadAnimation(this, R.anim.my_rotate); 
    main_button.startAnimation(rotateAnimation); 

回答

0

不能從XML :)

+0

爲此,我會一直把悲傷的臉哈哈,謝謝 – 2011-03-15 12:43:53