hossain-khan/android-constraint-layout-cheatsheet

Add circular positioning example.

hossain-khan opened this issue · 0 comments

Circular positioning (Added in 1.1)

You can constrain a widget center relative to another widget center, at an angle and a distance. This allows you to position a widget on a circle (see Fig. 6). The following attributes can be used:

    layout_constraintCircle : references another widget id
    layout_constraintCircleRadius : the distance to the other widget center
    layout_constraintCircleAngle : which angle the widget should be at (in degrees, from 0 to 360)


Fig. 6 - Circular Positioning

<Button android:id="@+id/buttonA" ... />
  <Button android:id="@+id/buttonB" ...
      app:layout_constraintCircle="@+id/buttonA"
      app:layout_constraintCircleRadius="100dp"
      app:layout_constraintCircleAngle="45" />