android-measure

Repeatedly altering visibility of a child view and measuring parent view causes wrong results in measured size and display

做~自己de王妃 提交于 2020-04-10 18:10:53
问题 Why is it that when you repeatedly alter the visibility of a child view that is contained within a parent view and measure the parent view, Android returns wrong results? I created a simple test: an XML file with only one ConstraintLayout and two TextViews. I will repeatedly alter the visibility of the last TextView to GONE and VISIBLE. Each time I alter the visibility of the TextView, I will measure the ConstraintLayout's width and height. To alter the visibility of the TextView, I set a

Repeatedly altering visibility of a child view and measuring parent view causes wrong results in measured size and display

此生再无相见时 提交于 2020-04-10 18:09:52
问题 Why is it that when you repeatedly alter the visibility of a child view that is contained within a parent view and measure the parent view, Android returns wrong results? I created a simple test: an XML file with only one ConstraintLayout and two TextViews. I will repeatedly alter the visibility of the last TextView to GONE and VISIBLE. Each time I alter the visibility of the TextView, I will measure the ConstraintLayout's width and height. To alter the visibility of the TextView, I set a