ConstraintLayout

Introduction to ConstraintLayout

What is ConstraintLayout

  • Advance layout mechanismim in adroid

  • Compatible with api 9+

  • relative positioning with constraints

  • flat viw hierarchy

  • Cassowary algorithm backs it

  • released at google i/o 2016

  • Easy mechanisim for animations

  • simplifies layouts

  • flexible controls

  • better rendering performance (becasue we don’t have to nest items)

Defination of constraint

‘The relationship between two views controls how will be positioned.’

Adding ConstraintLayout in the project

when we create new project in android studio it creates constraintLayout as top level dependency.

  1. Check if google() is in the repositories of project level build.gradle file.
  2. now go to module level build.gradle file and check in dependencies that implementation 'androidx.constraintlayout:constraintlayout:2.0.4'. use the latest version available.

Instructors and Resource References

https://riggaroo.dev https://twitter.com/riggaroo

Previous
Next