android - ConstraintLayout intermittent layout failure -
constraintlayout intermittently fails layout correctly when view set gone visible shortly after activity resumed:
<android.support.constraint.constraintlayout android:id="@+id/constraint_layout" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <textview android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintleft_toleftof="parent" app:layout_constrainttop_totopof="parent"/> <textview android:id="@+id/text2" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintleft_torightof="@id/text1" app:layout_constrainttop_totopof="parent"/> </android.support.constraint.constraintlayout> override fun onresume() { super.onresume() text1.text = "" text1.visibility = view.gone text2.text = "" text2.visibility = view.gone text1.postdelayed({ text1.text = "hello" text1.visibility = view.visible text2.text = "world" text2.visibility = view.visible }, 100 ) } instrumenting textview class reveals textview instances measured correctly width set 0 when laid out.
i wonder if constraintlayout linearsystem non-deterministic. there maps iterated on iteration order undefined? (i've seen cassowary)
i'm looking statement in github page:
constraintlayout intermittently fails layout correctly when view set gone visible shortly after activity resumed
i've checked out project , changed 100ms 1000ms. here's output:
it seems me, expect moment perform textview.setvisibility(view.gone) expect view not visible. that's not way android works. merely posting event messagequeue handled later looper, , 100ms not enough human eye see changes happening.

Comments
Post a Comment