Questions tagged [constraint-layout-chains]
67 questions
6
votes
1 answer
View is pushed out of its constraints in ConstraintLayout
I have a ConstraintLayout with an ImageView and 3 chained TextViews with a spread_inside chain style:
…

Nikolay Kulachenko
- 4,604
- 4
- 31
- 37
6
votes
5 answers
Constraint Layout not visible on the Layout file...And getting the error while inflating any view on it
I am using the constraint layout (android.support.constraint.ConstraintLayout) as the main layout in my XML file. As we get the two View of layout(One is for User View And Second is for the drag and drop the view and provide the relation between…

Ravindra Kushwaha
- 7,846
- 14
- 53
- 103
5
votes
2 answers
How to add Chains feature of constraint layout with design in android studio
I have two images in constraint layout. I want to use chains feature with design page in android studio but I can't find icon or menu that represent Chains feature.

saran chomphuphan
- 73
- 1
- 2
- 6
4
votes
1 answer
Create vertical chain from multiple horizontal chains with flat view hierarchy ConstraintLayout
I'm trying to take multiple horizontally-chained Buttons and TextViews and chain them vertically as sets of views, but still maintain a flat view hierarchy. Here is my initial layout and code:

David
- 834
- 1
- 10
- 27
4
votes
2 answers
ConstraintLayout weighted chains programmatically
If I try to create weighted chains in a ConstraintLayout programmatically then no views are shown. Creating them in a layout xml file works fine.
I tried to set width of views to MATCH_CONSTRAINT, but then they disappear. Also setting a horizontal…

masewo
- 801
- 9
- 11
4
votes
2 answers
View disappears when padding is added in constraint layout android
I'm trying to create a vertical chain of four circles using ConstraintLayout. It renders well until I add padding to the ConstraintLayout at which point, the entire view goes missing.
Contents of my layout file is as follows

Arun Kumar Nagarajan
- 2,347
- 3
- 17
- 28
4
votes
1 answer
ConstraintLayout beta5 wrap_content doesn't properly wrap
I have a XML layout for a ViewHolder inside a RecyclerView.
This layout's root is a ConstraintLayout whose height is set to wrap_content.
Inside this flat hierarchy there are 3 textviews and an image view with a fixed height; think of:…

Martin Marconcini
- 26,875
- 19
- 106
- 144
3
votes
1 answer
Android Constraint Layout all borke after update to 2.1.2 from 1.1.3
Recently I have decided to update my old project with the latest library as I wanted to learn how to migrate to use Jetpack compose.
But somehow once I upgrade my Constraint Layout Library from 1.1.3 to 2.1.2, some of the layouts just broke. I tried…

Ming
- 49
- 6
3
votes
2 answers
Set a max spacing between two views using Android's ConstraintLayout
I would like to know if there is any way to, in Android, using ConstraintLayout, to set a max spacing between two views when using Chains. I know that using the margin attributes works like a minimum spacing between two views, but I could not figure…

Augusto Carmo
- 4,386
- 2
- 28
- 61
3
votes
3 answers
Constraint Layout behaviour to match Linear layout behaviour
I wondered how to achive the same behaviour from Constraint Layout, it is easily doable with Linear layout, as you can see I have three views in a vertical linear layout , if I change visibility of midle one (textview2) to GONE , textView3 will…

bastami82
- 5,955
- 7
- 33
- 44
3
votes
3 answers
How to modify chain length in constraint layout?
Here is my code

Dishonered
- 8,449
- 9
- 37
- 50
3
votes
1 answer
Scaling vector graphics in ConstraintLayout
This is a "how-to" question.
I have an android activity with 6 ImageView objects in a ConstraintLayout. I would like them placed in a horizontal row, always using the full width of the screen. For larger screens, instead of blank spaces between…

John W
- 561
- 1
- 5
- 17
3
votes
1 answer
Center Vertically multiple view using Constraint Layout
I'm trying to make a ConstraintLayout to replace a regular layout with Relative and Linear layout but I'm having some troubles to center vertically two views inside a cardview.
The below layout file is my current layout that I want to replace.
…

lhts
- 61
- 1
- 3
3
votes
1 answer
ConstraintLayout within scrollview
I am looking to build a UI where I would like to show the scroll on landscape orientation and keep the button to the very bottom of the screen and stick to the footer but there should be fair gap between to scroll during landscape view.
Any help is…

Bulu
- 1,351
- 3
- 16
- 37
2
votes
2 answers
Chain two barriers in ConstraintLayout
I'm going to achieve this goal using ConstraintLayout:
The length of each TextView is not fixed and may change and the TextViews should be in the middle of their columns. I guessed that barriers and guidelines could help me if I chain barrier_left…

Alireza Noorali
- 3,129
- 2
- 33
- 80