Reputation: 6908
Is there a way to set the duration of rotation without using animation stuff, because those stuff causes some other stuff.
relative = (RelativeLayout) findViewById(R.id.relative);
relative.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
relative.setRotation(relative.getRotation() + 90);
return true;
}
});
Just smooth rotation and nothing more!
Upvotes: 1
Views: 279
Reputation: 2321
You literally can't have a smooth rotation without animating it. But, it doesn't have to be difficult. This will rotate your view by an additional 90 degrees over 300 milliseconds, and be nice and smooth:
relativeLayout.animate().rotationBy(90).setDuration(300).start();
Upvotes: 2