Development issue/problem:

I’m trying to set up a simple chatbubble with ConstraintLayout. That’s what I’m trying to realize:

But wrap_content doesn’t do what I want. It respects the fields, but it extends over the view. Here’s my file:

It seems to be the case:

I use

Am I doing something wrong? Is this a mistake or just intuitive behavior? Can I get the right behaviour with ConstraintLayout (I know I can use other layouts, I specifically ask for ConstraintLayout)

How can this problem be solved?

Decision No 1:

Obsolete: See best answer

No, you can’t do what you want with ConstraintLayout in the current version (1.0 beta 4) :

  • wrap_content only encourages the widget to compete, but will not limit its expansion against any restrictions.
  • match_constraints (0dp) will limit the size of the widget relative to the limitations … but it will fit even if the wrap_content is smaller (your first example), which is not what you want either.

In this particular case you are currently out of luck :-/

Now, uh… let’s think about adding extra functions to process exactly this script (which behave like wrap_content unless the size ends more than the limitations).

However, I cannot promise that this new feature will be available before the release of version 1.0.

Edit: We added this function in version 1.0 with the attribute app:layout_constraintWidth_default=wrap (with a width set to 0dp). If installed, the widget has the same size as wrap_content, but it is limited by limitations (i.e. it cannot go beyond that).

These tags are now obsolete, use layout_width=WRAP_CONTENT and layout_constrainedWidth=true.

Decision No 2:

Update (ConstraintLayout 1.1.+)

Use app:layout_constrainedWidth=true with android:layout_width=wrap_content

Previously (obsolete):

app:layout_constraintWidth_default= wrap with android:layout_width=0dp

Decision No 3:

Yes, as already mentioned in Nicholas Rord’s answer, you need to add app:layout_constraintWidth_default=wrap and set the width to 0dp And to align the bubble on the right, you need to set 1.0 for layout_constraintHorizontal_bias.

Here’s the final source code:

This gives the following picture:

Decision No 4:

As mentioned in other answers, this can be done since ConstraintLayout 1.0, but with the release of the new version (1.1.x), they have changed the way they do it.

Since the release of ConstraintLayout 1.1, the old attributes app:layout_constraintWidth_default=wrap and app:layout_constraintHeight_default=wrap have become obsolete.

If you want to guarantee the behaviour of wrap_content while setting restrictions on your view, you must set its width and/or height to wrap_content in combination with the attributes app:layout_constrainedWidth=true|false and/or app:layout_constrainedHeight=true|false, as specified in the documentation :

WRAP_CONTENT : Application of restrictions (added in 1.1) If
is defined in WRAP_CONTENT, then it is literally considered to be
in versions up to 1.1 – this means that restrictions do not restrict the resulting
measurement. Although this is usually sufficient (and faster), you can use WRAP_CONTENT in some
situations, but continue to apply restriction
to limit the resulting dimensionality. In this case you can add one of the attributes corresponding to

As for the latest version, ConstraintLayout is at the time of my response to version 1.1.2.

Decision No 5:

Wrap_content view inside a ConstraintLayout stretches outside the screen –

Reply app:layout_constraintWidth_default=wrap and android:layout_width=0dp now DEPRECEDE.

Continue to use app:layout_constrainedWidth=true and android:layout_width=wrap_content.

Because of the depression, I don’t know. But his right in the ConstraintLayout source code

Decision No 6:

I’m using this.


Decision No 7:

You must take the place of

android: layout_width=wrap_content


android: layout_width=match_parent

of your TextView, then adjust the padding and field accordingly.
I updated your code,

You get the result
Wrap_content view inside a ConstraintLayout stretches outside the screen – .

Good luck!

how do you cancel curology,curiosity stream app,nebula,how to cancel curious world,curiosity app,how to cancel streams for us,curious morty review,how to delete curious cat account,curiositystream issues,watch nebula,how do i cancel my curology subscription,amazon appstore,roku,how to cancel curiositystream on amazon,curiosity stream,curiositystream optimum login,cancel curiosity stream through google,curiosity stream tivo,curiosity stream manage account,curiositystream free login

You May Also Like

Start Earning By Increasing Your Instagram Followers  •

Nowadays people spend most of their time on social networks. For most…

246869 Windows systems are still vulnerable to the BlueKeep flawSecurity Affairs

In May 2019, Microsoft discovered the vulnerability of BlueKeep; more than a…

Marketing definition of SEO (Search Engine Optimization)

What is natural referencing? Natural referencing, or SEO in English for Search…

That’s the difference between SEA and SEO

Online marketing has become very popular in recent years. Terms like SEO (Search…