Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

2.0.0beta4-2.0.0 bug: Layouts disappear due to width/height 0 when visibility is changed and view then animates in #91

Open
arberg opened this issue Aug 25, 2020 · 2 comments

Comments

@arberg
Copy link

arberg commented Aug 25, 2020

Works in : implementation "androidx.constraintlayout:constraintlayout:1.1.3"
Others: I didn't try beta5 in my 'binary' search, and alpha4, beta1 failed with linking error)
Fails in : implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta4"
Fails in : implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta6"
Fails in : implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta7"
Fails in : implementation "androidx.constraintlayout:constraintlayout:2.0.0-beta8"
Fails in : implementation "androidx.constraintlayout:constraintlayout:2.0.0"

Subviews of constraint-layout sometimes vanish when their visibility is changed from gone->visible. So showing/hiding views in constraint layout seems broken, which if true is a major issue.

It is very likely related to the flickering of this issue, as this also appeared first time in beta8, and it could be related to same dissapearing trick: #87

When the views have vanished and I connect the android studio 4.0.0 layout inspector it shows width/height=0 and sometimes incorrect x coordinate, and correctly with visibibility visible. I can only reproduce the bug when layout inspector is not in live mode. The flickering which is probably that mentioned in issue 87 is sometimes visible as views dissapear, because they blink in and out of existence. The flickering also cannot be seen in live mode of layout inspector.

See two layouts in which I have seen this problem. I have removed sibling layouts of the complex named one, but not parent layouts in this file.

I suspect the issue is only present when the visibility change is made when layout parent layout is set to animate in to screen.

I have check for when in-animation completes, and then calls request layout on all constraint-layouts in the tree being animated in. Now views appear once animation finishes. This also indicates its a bug in the ConstraintLayout and not my usage of it. I use viewBindings to change the visibility of the views.

I'm by now pretty sure it works in 1.1.3, say 97 % sure, at least for how I use it. I may just have failed to reproduce it, though by now I can do it fairly easy.

complex-panel.xml.txt
simpler-panel.xml.txt

@arberg arberg changed the title 2.0.0 + 2.0.0beta8 bug (not present in 2.0.0beta7): Layouts disappear due to width/height 0 when visibility changed 2.0.0beta4-2.0.0 bug: Layouts disappear due to width/height 0 when visibility is changed and view then animates in Aug 25, 2020
@applantern
Copy link

Ups, this is not the right bugtracker. I have placed it here:

https://issuetracker.google.com/issues/166486013

@atulgpt
Copy link

atulgpt commented May 10, 2021

@arberg This issue is fixed under https://issuetracker.google.com/issues/166486013 We can close this bug
cc @applantern

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants