ConstraintLayout 1.1.0: Circular Positioning

Android just published ConstraintLayout 1.1.0 beta 3 on the google maven repository.One of the more interesting additions in this release is Circular Positioning. Circular positioning allows you to 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.

ConstraintLayout Circular constraints

Add ConstraintLayout to your project


To use ConstraintLayout in your project, proceed as follows:

1.Ensure you have the maven.google.com repository declared in your project-level build.gradle file:

2.Add the library as a dependency in the same build.gradle file:

Example Circular positioning


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).

 

Related Post

New features in Constraint Layout 1.1.0

 

Leave a Reply

Your email address will not be published. Required fields are marked *