constraintlayout icon indicating copy to clipboard operation
constraintlayout copied to clipboard

Starting from version 2.1.0, ConstraintLayout is sporadically laying out children incorrectly

Open vijtheveg opened this issue 3 years ago • 6 comments

The children of a ConstraintLayout are sporadically being laid out incorrectly, starting version 2.1.0. This error happens in Android Studio preview, on an emulator and on a physical device.

This image below, shows the error, where the child (with blue border) is shown at the top of the parent, instead of at the bottom. This happens whether I use a vertical flow or a vertical chain to layout the children. This very same layout used to work fine in 2.0.4

image

If I just change the version to 2.0.4, Android Studio preview starts laying out correctly (see below). The exact same XML works as correctly in the emulator and device as well, if I use 2.0.4.

image

The funny thing is that some instances of the same ConstraintLayout view layout fine, while others don't. Here are two adjacent elements of a RecyclerView. Both are the same layout - one is rendering correctly, while the other isn't

image

The layout file can be found here. sales_order_card.zip

The same problem happens in other layouts as well, and is not unique to this layout. This happens both on SDK 26 and SDK 30. The problem persists in version 2.1.1 as well.

vijtheveg avatar Oct 09 '21 12:10 vijtheveg

Hi All, I also recently updated to 2.1 and my app UI is also broken.
I am creating customview inheriting from constraint layout. Looks like child is not getting rendered vertically inside the layout

sunilcnair avatar Dec 08 '21 00:12 sunilcnair

Any updates? This bug is reproducible even in version 2.1.13. This is a pretty serious bug, and it is suprising that there is no resolution even after so many months.

vijtheveg avatar Jan 22 '22 07:01 vijtheveg

Same as @vijtheveg , I am often facing this bug. Has anyone solved? In my case, this problem appears with only Android8, 9, 11 and 12.

furusin avatar Oct 26 '22 01:10 furusin

Just found this issue and finally understand what happened. I enabled R8 full mode last week and published the update, then I received bug reports about text being overlapped from users this week. It took me a while to figure it out because this bug only happens on a small amount of device models. This bug still exists in ConstraintLayout 2.1.4

evilhawk00 avatar Nov 25 '22 19:11 evilhawk00

Just found this issue and finally understand what happened. I enabled R8 full mode last week and published the update, then I received bug reports about text being overlapped from users this week. It took me a while to figure it out because this bug only happens on a small amount of device models. This bug still exists in ConstraintLayout 2.1.4

Thanks @evilhawk00! Any idea when this bug will be fixed?

vijtheveg avatar Feb 25 '23 13:02 vijtheveg