Alex Shiganov
Alex Shiganov

Reputation: 133

Changing visibility of element in constraint.Group

I have spent an hour trying to figure out, who is changing one of my views visibility. It turned out to be constraint.Group.

Well, from the start: I have, for example, seven views, five of them (under certain circumstances) should have visibility GONE. One of these five views have its own logic to be visible or not, but if all five are gone, it is gone. I thought it is a good idea to place five elements in a constraint.Group , apply logic for group, and then apply logic for one of them. Error: one of them will have the same visibility as other in a group, even if I change it after inflate.

What has to be done here to preserve two kind of logic? Not using constraint.Group at all? Remove one view from constraint.Group?

Upvotes: 1

Views: 868

Answers (1)

Nitin Gurbani
Nitin Gurbani

Reputation: 1240

Yes, definitely you will need to remove that one view from android.support.constraint.Group if you want that specific view's visibility logic to work correctly as otherwise whatever the visibility of the android.support.constraint.Group will be there; will also get applied to the visibility of that view and that's why you need to exclude it from the android.support.constraint.Group to avoid problems and thus get your desired outcome.

Upvotes: 3

Related Questions