Android 如何使用对象动画旋转动画

Android 如何使用对象动画旋转动画,android,android-layout,Android,Android Layout,我想旋转其他图像也相对于动画图像移动的图像 XML是: <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" an

我想旋转其他图像也相对于动画图像移动的图像

XML是:

    <ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="86dp"
    android:src="@drawable/top_pati" />
<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/imageView1"
    android:layout_below="@+id/imageView1"
    android:src="@drawable/top_pativertical" />
<ImageView
    android:id="@+id/imageView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/imageView1"
    android:layout_below="@+id/imageView1"
    android:src="@drawable/top_pativertical" />
我想使用对象动画,这里我使用旋转动画,它不移动imageview的实际位置
如何使用对象动画..

创建此xml文件并在xml的imageview中设置此文件

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/loading"
    android:pivotX="50%"
    android:pivotY="50%" />


此示例设置为在一个图像上应用多个动画。

animation-anim=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animation);图像视图。startAnimation(动画);异常启动动画-rotatedjava.lang.RuntimeException:未知动画名称:动画rotateRotateAnimation anim=新的旋转动画(0f、350f、15f、15f);anim.setInterpolator(新的LinearInterpolator());anim.setRepeatCount(Animation.INFINITE);动画设定持续时间(700);//开始设置图像最终ImageView splash=(ImageView)findViewById(R.id.splash)的动画;splash.startAnimation(动画);//以后。。停止动画splash.setAnimation(null);从这段代码中,我的实际视图不移动我想移动我的实际视图,其他图像(imageView2和imageView2)也相对于imageView1移动我想使用对象动画执行旋转动画功能,我的实际视图也会更改此链接中的位置查看图像我想左侧图像位于上方(与其他图像链接)和其他下拉,那么我能做什么呢?我的布局还将imageview2和imageview3设置在imageview1下方,这样当它设置动画时,为什么imageview2和imageview3不在imageview1下方
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/loading"
    android:pivotX="50%"
    android:pivotY="50%" />
RotateAnimation anim = new RotateAnimation(0f, 350f, 15f, 15f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(700);

// Start animating the image
final ImageView splash = (ImageView) findViewById(R.id.splash);
splash.startAnimation(anim);

// Later.. stop the animation
splash.setAnimation(null);
   final ImageView mytrain = (ImageView) findViewById(R.id.train);
   final Animation traintween = AnimationUtils.loadAnimation(this,R.anim.treinanimation);
   final Animation trainfade = AnimationUtils.loadAnimation(this,R.anim.trainfade);
   AnimationSet s = new AnimationSet(false);//false mean dont share interpolators
   s.addAnimation(traintween);
   s.addAnimation(trainfad);
   mytrain.startAnimation(s);