androidandroid-constraintlayoutconstraint-layout-chains

How many views can be chained(add relationship) inside ConstraintLayout


Constraint layout in Android supports view chaining (https://developer.android.com/reference/android/support/constraint/ConstraintLayout#chain-style)

I checked several examples, everywhere only 3 views are showcased to demonstrate the concept.

Is 3 the limit?

I tried to add 4th element, but its not chained as per the concept. Chaining with 3 Elements

chaining with 3 elements

Chaining with 4 elements

Chaining with 4 elements

Code - https://gist.github.com/vamsigp/784be59f8ae1e2137ece1349c726d1f8


Solution

  • You have an error in your layout:

    app:layout_constraintRight_toRightOf="share2"
    

    Should be:

    app:layout_constraintRight_toLeftOf="@+id/share2"