Questions tagged [constraint-layout-chains]
67 questions
2
votes
2 answers
How many views can be chained(add relationship) inside ConstraintLayout
Constraint layout in Android supports view chaining (https://developer.android.com/reference/android/support/constraint/ConstraintLayout#chain-style)
I checked several examples, everywhere only 3 views are showcased to demonstrate the concept.
Is 3…

Vamsi
- 5,853
- 6
- 29
- 36
2
votes
1 answer
Chained view displaced in ConstraintLayout
I've encountered a problem with ConstraintLayout while simply placing 2 views in the center of screen. Like Title and Content bellow. Both should be centered vertically. So my layout looks like:

Eugene Nefedov
- 480
- 3
- 11
2
votes
1 answer
ConstraintLayout left align the middle element of two horizontal chains?
I am creating a layout where i need to create 2 rows of three elements each. For the middle elements (Qty and 4901) of both rows I want the text to left align.
I have created 2 horizontal chains with chainStyle as spread_inside.
Here is the layout…

Ashesh Bharadwaj
- 183
- 2
- 12
2
votes
0 answers
How do I create a square grid using a ConstraintLayout with labels for the rows that are vertically centered?
I need to create a square grid with labels for the rows on the left side. The grid should use the entire space available on the device while keeping width=height. Because this grid has several rows and several columns automatically adjusted, I…

ema3272
- 1,021
- 2
- 13
- 28
1
vote
2 answers
ConstraintLayout stick view to wrap_content view
I tried to stick counter to nameText while counter should not exceed the container from the right side.
I want to only use the xml and no programmatically change it.
I played with the layout.xml
code example:

motis10
- 2,484
- 1
- 22
- 46
1
vote
0 answers
Constraint Layout how do I get rid off the extra space on textview when the view is multiline
I would like to place two Imageviews before a textview. When the textview is single line then I am getting the desired output see below
If the textview is multiline then extra space is added and I am not sure how to fix it. Here is the image and…

falcon2403
- 33
- 4
1
vote
3 answers
ConstraintLayout spread views inside with same width
I want to have a horizontal alignment of four buttons with these conditions:
their texts are 25%, 50%, 75%, 100% (so the last one will be wider)
they should have same width
they should spread the through the remaining space
Is it possible to…

momvart
- 1,737
- 1
- 20
- 32
1
vote
3 answers
Constrain layout with padding and no margin, ignore some spacing
I have a constraintLayout-1.1 with 5 textViews.
I want to center horizontally the 3rd textView and spread its siblings packed to it.
However when I try this, I see the space between the children is not even.
I want to view to be packed to the…

Elad Benda
- 35,076
- 87
- 265
- 471
1
vote
2 answers
Android constraint layout changes it's appearance in Mobile
Layout is looking awesome but not in Mobile. How to overcome it!!!
tried to connect each view to parent separately, watched some tutorials to resolve the issue but it was not resolving the issue.I tried to connect each view with parent but it didn't…

Kaleem
- 129
- 1
- 14
1
vote
1 answer
Android ConstraintLayout - how to set margins of chain_packed elements programmatically
This is my code:
ConstraintLayout.LayoutParams buttonParams = new ConstraintLayout.LayoutParams(40,105);
buttonParams.setMargins(8,16,24,32);
secretCodeFields = findViewById(R.id.secretCodeFields);
for (int i = 0; i < 4; i++) {
Button b = new…

Patryk Godowski
- 1,081
- 7
- 7
1
vote
1 answer
Create constraint layout chain programmatically
I have a constraint layout which consists of 2 static textviews and a few buttons added programmatically. I want to create a chain with all that buttons but I can't get it working properly as a few buttons are stuck to middle-bottom of the layout.
I…
user10872815
1
vote
2 answers
ConstraintLayout and table
I want to get table 3х3. The rows should have the same height and the cells should be equal.
I tried using ConstraintLayout with weights and it works if i make one row

Dima
- 1,189
- 1
- 8
- 12
1
vote
1 answer
How do I center a packed chain in a ConstraintLayout that contains a View with width `0dp`?
I want to center the headline of my page. The headline can look like (1) Dokument1 or (3) GreatDocument. I want to have right and left margins of 60dp and the name of the document has a variable length. When I use wrap_content for @+id/title the…

Christian
- 25,249
- 40
- 134
- 225
1
vote
2 answers
Bias attribute is ignored
I have a simple layout of horizontally chained views with spread_inside chain style. When I try to move the views using the bias attribute to desired position I've found out that bias attribute is ignored.
Here is layout for…

cheshie
- 421
- 1
- 6
- 18
1
vote
3 answers
ConstraintLayout Treats Multiple Horizontal Chains Differently
I am attempting to set up what I thought should be a simple layout with a ConstraintLayout I have a series of text entries, with labels whose size can change from language to language. There is a barrier to the right side of the labels so the text…

Tyler V
- 9,694
- 3
- 26
- 52