I am working at a project in Xamarin. Android where I use the CircleImageView
NuGet package(which is just a library for RoundedImageViews
). I have a CircleImageView
(call it civ1
), and another one(call it civ2
). I want to rotate
civ2
around civ1
's center, at a certain angle. I know I can use
android:rotation="90"
to rotate civ2
, but this will just rotate it around its own center which I don't want. So how could I rotate
civ2
around civ1
's center point?
<FrameLayout
android:id="@+id/IDEQSVFL"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/roundcornerslayout">
<refractored.controls.CircleImageView
android:id="@+id/civ1"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginLeft="30dp"
android:layout_gravity="left|center_vertical"
android:src="@drawable/ME_RotatoryKnobMainImage" />
<refractored.controls.CircleImageView
android:id="@+id/civ2"
android:layout_width="11dp"
android:layout_height="11dp"
android:layout_gravity="left|center_vertical"
android:src="@drawable/ME_RotatoryKnobLed" />
</FrameLayout>
This is my code.
android:rotation="90" to rotate civ2, but this will just rotate it around its own center which I don't want. So how could I rotate civ2 around civ1's center point?
If you want the small circle to be in certain position that related to the circle 2, you just need to modify layout_marginLeft
and layout_marginTop
to change the position of the small circle:
<FrameLayout
android:id="@+id/IDEQSVFL"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="300dp"
android:background="@drawable/snow">
<refractored.controls.CircleImageView
android:id="@+id/civ1"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginLeft="30dp"
android:layout_gravity="left|center_vertical"
android:src="@drawable/timg2" />
<refractored.controls.CircleImageView
android:id="@+id/civ2"
android:layout_width="11dp"
android:layout_height="11dp"
android:layout_marginTop="50dp"
android:layout_marginLeft="78dp"
android:layout_gravity="top"
android:src="@drawable/timg2" />
</FrameLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.