2011-03-15 114 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