I want to set an infinite move animation around a circle to a View like picture below.How can i achieve this?
This View may be a TextView o
The problem is solved with this solution i made that rotate the container of the view clockwise and the TextView counter clockwise :)
The layout:
The animation:
View v = findViewById(R.id.cont);
View text = findViewById(R.id.text);
int durationMillis = 10000;
RotateAnimation r = new RotateAnimation(0, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
r.setDuration(durationMillis);
r.setInterpolator(new LinearInterpolator());
r.setRepeatMode(Animation.RESTART);
r.setRepeatCount(Animation.INFINITE);
text.startAnimation(r);
RotateAnimation rC = new RotateAnimation(360, 0,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rC.setDuration(durationMillis);
rC.setInterpolator(new LinearInterpolator());
rC.setRepeatMode(Animation.RESTART);
rC.setRepeatCount(Animation.INFINITE);
v.startAnimation(rC);
But if you want to move an object in other paths and looking for a general solution, checkout the @Kevin's solution(Thanks to him).