ConstraintLayout View.GONE usage

Viewed 13276

I recently started using ConstraintLayout. As I discovered, most of the features are pretty straight forward, and well explained in the docs with samples, text and video tutorials and all.

The thing that got in my mind is how to I solve this 'puzzle' as elegant as possible?

looking good blueprint poor looking blueprint

As you can see, in the right section of the layout, I have multiple Views aligned left. On the last but one row, there are 3 Views aligned horizontally (they are also aligned TOP between each other). Problem is: if I set first View's visibility from that row as GONE, the other two (in the same row), go left as expected, but the one underneath (last row in the vertical alignment) goes over the row before (because its constraintTop property is set as bottom of the View set as GONE).

The only solution I can think of is using a ViewGroup to group those 3 Views and add the constraint to last row View to it.

Am I missing some property on ConstraintLayout which could help my case? Maybe some sort of fallback (or multiple) constraints if one of them is set on a GONE View?

Sorry if my explanation seem quite abstruse, maybe the pictures will help you more :)

LE: Added layout: https://gist.github.com/DoruAdryan/7e7920a783f07b865489b1af0d933570

1 Answers
Related