Below code rotates clockwise when touched. What I want is to detect the user interaction with the layout and rotate accordingly.
relative.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
relative.animate().rotationBy(60).setDuration(300).start();
}else if(event.getAction() == MotionEvent.ACTION_UP){
relative.animate().rotationBy(0).setDuration(10).start();
}
return true;
}
});
Without using animation stuff, using animations some functions like onClick events don't work properly on the layout.