This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
Textview with constrainedHeight inside a ConstraintLayout with height wrap_content expands the ConstraintLayout and prevents ellipsize #855
Labels
bug
Something isn't working
· Issue
I was trying to do a special view where a text can expand up it's constraints size and then ellipsize. This text has a button below itself, so the button should also be in the layout and prevent being hidden. The main layout should have
wrap_content
as there are more parts of the layout, and this button and text are constrained inside the bounds of another view.The main problem is that the constraint layout is getting a little crazy if it has
wrap_content
as height, as the text is expanding the view when it shouldn't. If I had a fixed height in the parent (thing that I don't want), then the ellipsize of theTextView
is not working. I attach two example xmls and their captures.· Examples
Wrap Content issue:
You can see in this example that the textview and button expands further from the view where they should be constrained (the grey view)
Not ellipsize issue // match parent or fixed size inside the
ConstraintLayout
Here we can see that when this works as intended design wise, but the ellipsize does not work and we can even see the text rendering behind the textview bounds.
I attach a picture of the render of the xml with a small text inside the view to show why this approach is needed:
There you can see that we want both text and button together and centered inside the view and prevent it from expanding further with an ellipsize in that case.
· Version
I'm using ConstraintLayout version 'androidx.constraintlayout:constraintlayout:2.1.4'
The text was updated successfully, but these errors were encountered: