Я хочу, чтобы повернуть изображение, другие изображения также перемещаться относительно анимационного изображенияКак вращать анимацию с объектом анимации
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" />
Java код так:
imageView= (ImageView) findViewById(R.id.imageView1);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
RotateAnimation anim = new RotateAnimation(0,45 , Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setInterpolator(new LinearInterpolator());
anim.setDuration(500);
anim.setFillEnabled(true);
anim.setFillAfter(true);
imageView.startAnimation(anim);
}
});
Я хочу использовать анимацию объекта, здесь я использую анимацию вращения, которая не перемещает фактическую позицию изображения. как я могу использовать анимацию объекта.
Анимация аним = AnimationUtils.loadAnimation (getApplicationContext(), R.anim.animation); \t \t \t \t imageView.startAnimation (anim); исключение на анимированное вращение – user3106818
исключение? – dipali
java.lang.RuntimeException: Неизвестное имя анимации: animated-rotate – user3106818