I have two circle layouts(relative) inner and outer in Frame layout (parent), i need to rotate the outer circle by two finger gesture, but not the inner circle layout, how can i achieve this.Like in below picture , outer circle will only rotate with their child circle but not the inner one
Asked
Active
Viewed 66 times
2 Answers
0
I believe rotating outer layout by the amount you want and then the inner layout until it rotates 360 degrees will give you what you want.
float degrees = 30.0f;
outerLayout.setRotation(degrees); innerLayout.setRotation(360 - degrees);
Note that if you need to rotate the views again you should use the full degrees rotat on value. Meaning for 3 rotations 90 degrees, for 4120 etc.
-
thanks Spyros, it works , but rotation is very fast.can we rotate outer layout slow? – B. Rahul Kumar May 08 '19 at 10:47
-
You will need to make an animator and use android:fromDegrees and android:toDegrees. Check this out and try something similar http://www.androidhive.info/2013/06/android-working-with-xml-animations/ – AlephRZS May 08 '19 at 11:02
-
thanks Spyros, but i have rotate with finger gesture detection , clockwise and anti clock wise – B. Rahul Kumar May 08 '19 at 16:47
0
You can do this with RelativeLayout like this
<RelativeLayout>
<LinearLayout> //Your Outer Layout
</LinearLayout>
<LinearLayout> //Your Inner Layout
</LinearLayout>
</RelativeLayout>
And perform operation on your Outer Layout. You can use any child view inside RelativeLayout according to your need. I just use LinearLayout for example.

Ajay Gohel
- 243
- 7
- 17