Например, если я переместу панель поиска на 100, я хочу, чтобы imageView повернулся на 100 градусов в течение одной секунды.Проблема в том, что если я переместу его сразу к 50, он перейдет к 100 и медленно пойдет до 50. Есть ли способ повернуть его из текущей позиции ... или, может быть, более элегантное решение для более плавной анимации для этих случайных градусов?
seekBar1 = (SeekBar) findViewById(R.id.seekBar1);
arrow2 = (ImageView) findViewById(R.id.imageView1 );
seekBar1.setOnSeekBarChangeListener( new OnSeekBarChangeListener()
{
public void onProgressChanged(SeekBar seekBar1, int progress, boolean fromUser)
{
currentSpeed.setText(""+progress);
RotateAnimation rotateAnimation = new RotateAnimation(fromPosition ,progress,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setDuration(1000);
rotateAnimation.setFillAfter(true);
arrow2.startAnimation(rotateAnimation);
fromPosition=progress;
}
public void onStartTrackingTouch(SeekBar seekSize1) {}
public void onStopTrackingTouch(SeekBar seekSize1) {}
});