How do i correctly use 2 chains next to eachother in constraintLayout (android) without overlay of the chains when views grow bigger?How to set tint for an image view programmatically in android?Overdraw on separatorHow to center multiple Views together using ConstraintLayout?How can I get the latest version of ConstraintLayout for Android?Pack two adjacent views in a spread-chain ConstraintLayoutAndroid - how to make a scrollable constraintlayout?How to make view “wrap_content but not larger than” with ConstraintLayout?ConstraintLayout chain does not work if some chained views constrained to another chained viewHow to overlay a view in a constraintlayout?View disappears when apply ConstraintSet in Constraintlayout android
Chess with symmetric move-square
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
black dwarf stars and dark matter
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
Copycat chess is back
How long does it take to type this?
How to add power-LED to my small amplifier?
Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)
What defenses are there against being summoned by the Gate spell?
Why is "Reports" in sentence down without "The"
How to report a triplet of septets in NMR tabulation?
How much RAM could one put in a typical 80386 setup?
Is there a familial term for apples and pears?
XeLaTeX and pdfLaTeX ignore hyphenation
Are tax years 2016 & 2017 back taxes deductible for tax year 2018?
Download, install and reboot computer at night if needed
What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?
Schwarzchild Radius of the Universe
"which" command doesn't work / path of Safari?
What is the offset in a seaplane's hull?
How is it possible to have an ability score that is less than 3?
Is there really no realistic way for a skeleton monster to move around without magic?
TGV timetables / schedules?
Is it possible to make sharp wind that can cut stuff from afar?
How do i correctly use 2 chains next to eachother in constraintLayout (android) without overlay of the chains when views grow bigger?
How to set tint for an image view programmatically in android?Overdraw on separatorHow to center multiple Views together using ConstraintLayout?How can I get the latest version of ConstraintLayout for Android?Pack two adjacent views in a spread-chain ConstraintLayoutAndroid - how to make a scrollable constraintlayout?How to make view “wrap_content but not larger than” with ConstraintLayout?ConstraintLayout chain does not work if some chained views constrained to another chained viewHow to overlay a view in a constraintlayout?View disappears when apply ConstraintSet in Constraintlayout android
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've been struggling with this for days now. Its probably possible without constraintLayout to get this done, but i'm would really like it to be done with constraintLayout.
I have 6 views next to eachother. 4 on the left side, 2 on the right, but at the same height.
Those 2 on the left, they don't change width and they should be on the right always.
Those 4 on the right change sizes and, more important, sometimes not all 4 views wil show up.
I cant chain the six of them of course, because then, if there are only 2 tags on the left side, my 2 views on the right will move to the left.
My best attempt was chaining the 4 views on the left. And chaining the 2 views on the right. That works perfectly fine, except! when there is a larger view on the right, then these 4 views will overlay the 2 views on the right. But, whenever i make a constraint to make sure the 4 views will NOT overlay my right views, android thinks i'm chaining 6 views and i get the problem above.
Well, anyone who knows a fine trick to solve this? Its really a big puzzle for me.
This is how it should look:
How i want it to look (a bit like) so always a margin between the 4th and 5th view.
And here's the code i used:
(i have been struggling though and tried a lot of things like guidelines and barriers, so it's certainly nog yet clean and nice coding)
<TextView
android:id="@+id/distance"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="1,7 km" />
<TextView
android:id="@+id/freeKm"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:minWidth="82dp"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100 vrije km" />
<TextView
android:id="@+id/yearOfConstruction"
style="@style/helveticaRoman15"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/freeKm"
app:layout_constraintTop_toTopOf="@+id/distance"
app:layout_constraintWidth_max="50dp"
tools:text="bouwjaar" />
<TextView
android:id="@+id/newIndicator"
style="@style/helveticaMedium15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:gravity="center"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
app:layout_constraintTop_toTopOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="thumbImage, numberOfBookings"
tools:layout_editor_absoluteX="411dp" />
<ImageView
android:id="@+id/thumbImage"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@color/yellow"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="82dp" />
android android-constraintlayout
add a comment |
I've been struggling with this for days now. Its probably possible without constraintLayout to get this done, but i'm would really like it to be done with constraintLayout.
I have 6 views next to eachother. 4 on the left side, 2 on the right, but at the same height.
Those 2 on the left, they don't change width and they should be on the right always.
Those 4 on the right change sizes and, more important, sometimes not all 4 views wil show up.
I cant chain the six of them of course, because then, if there are only 2 tags on the left side, my 2 views on the right will move to the left.
My best attempt was chaining the 4 views on the left. And chaining the 2 views on the right. That works perfectly fine, except! when there is a larger view on the right, then these 4 views will overlay the 2 views on the right. But, whenever i make a constraint to make sure the 4 views will NOT overlay my right views, android thinks i'm chaining 6 views and i get the problem above.
Well, anyone who knows a fine trick to solve this? Its really a big puzzle for me.
This is how it should look:
How i want it to look (a bit like) so always a margin between the 4th and 5th view.
And here's the code i used:
(i have been struggling though and tried a lot of things like guidelines and barriers, so it's certainly nog yet clean and nice coding)
<TextView
android:id="@+id/distance"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="1,7 km" />
<TextView
android:id="@+id/freeKm"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:minWidth="82dp"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100 vrije km" />
<TextView
android:id="@+id/yearOfConstruction"
style="@style/helveticaRoman15"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/freeKm"
app:layout_constraintTop_toTopOf="@+id/distance"
app:layout_constraintWidth_max="50dp"
tools:text="bouwjaar" />
<TextView
android:id="@+id/newIndicator"
style="@style/helveticaMedium15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:gravity="center"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
app:layout_constraintTop_toTopOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="thumbImage, numberOfBookings"
tools:layout_editor_absoluteX="411dp" />
<ImageView
android:id="@+id/thumbImage"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@color/yellow"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="82dp" />
android android-constraintlayout
1
Hi and welcome... Please see how to ask: stackoverflow.com/help/how-to-ask
– SakoBu
Mar 8 at 22:40
thank you, is this a better question now?
– Titei
Mar 9 at 14:01
Did you actually name the parent layout "parent"? If not, you don't need the id tag for parent. Instead of this: app:layout_constraintTop_toTopOf="@+id/parent", use this: app:layout_constraintTop_toTopOf="parent". Also, the barrier on its own will do nothing, unless you constrain that to the guideline. I would also suggest using percentages instead of hardcoded values and horizontal/vertical biases.
– Nikos Hidalgo
Mar 13 at 11:17
hi thx, no, offcours it should have been just "parent". And yes, i mostly use percentages in my guidelines. I will work on this the coming days and will try to constrain that barrier as you say. I'm not very confident that that will do the tric. I might end up using linear layouts anyway with the tags embedded in them.
– Titei
Mar 16 at 21:50
add a comment |
I've been struggling with this for days now. Its probably possible without constraintLayout to get this done, but i'm would really like it to be done with constraintLayout.
I have 6 views next to eachother. 4 on the left side, 2 on the right, but at the same height.
Those 2 on the left, they don't change width and they should be on the right always.
Those 4 on the right change sizes and, more important, sometimes not all 4 views wil show up.
I cant chain the six of them of course, because then, if there are only 2 tags on the left side, my 2 views on the right will move to the left.
My best attempt was chaining the 4 views on the left. And chaining the 2 views on the right. That works perfectly fine, except! when there is a larger view on the right, then these 4 views will overlay the 2 views on the right. But, whenever i make a constraint to make sure the 4 views will NOT overlay my right views, android thinks i'm chaining 6 views and i get the problem above.
Well, anyone who knows a fine trick to solve this? Its really a big puzzle for me.
This is how it should look:
How i want it to look (a bit like) so always a margin between the 4th and 5th view.
And here's the code i used:
(i have been struggling though and tried a lot of things like guidelines and barriers, so it's certainly nog yet clean and nice coding)
<TextView
android:id="@+id/distance"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="1,7 km" />
<TextView
android:id="@+id/freeKm"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:minWidth="82dp"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100 vrije km" />
<TextView
android:id="@+id/yearOfConstruction"
style="@style/helveticaRoman15"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/freeKm"
app:layout_constraintTop_toTopOf="@+id/distance"
app:layout_constraintWidth_max="50dp"
tools:text="bouwjaar" />
<TextView
android:id="@+id/newIndicator"
style="@style/helveticaMedium15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:gravity="center"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
app:layout_constraintTop_toTopOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="thumbImage, numberOfBookings"
tools:layout_editor_absoluteX="411dp" />
<ImageView
android:id="@+id/thumbImage"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@color/yellow"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="82dp" />
android android-constraintlayout
I've been struggling with this for days now. Its probably possible without constraintLayout to get this done, but i'm would really like it to be done with constraintLayout.
I have 6 views next to eachother. 4 on the left side, 2 on the right, but at the same height.
Those 2 on the left, they don't change width and they should be on the right always.
Those 4 on the right change sizes and, more important, sometimes not all 4 views wil show up.
I cant chain the six of them of course, because then, if there are only 2 tags on the left side, my 2 views on the right will move to the left.
My best attempt was chaining the 4 views on the left. And chaining the 2 views on the right. That works perfectly fine, except! when there is a larger view on the right, then these 4 views will overlay the 2 views on the right. But, whenever i make a constraint to make sure the 4 views will NOT overlay my right views, android thinks i'm chaining 6 views and i get the problem above.
Well, anyone who knows a fine trick to solve this? Its really a big puzzle for me.
This is how it should look:
How i want it to look (a bit like) so always a margin between the 4th and 5th view.
And here's the code i used:
(i have been struggling though and tried a lot of things like guidelines and barriers, so it's certainly nog yet clean and nice coding)
<TextView
android:id="@+id/distance"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="1,7 km" />
<TextView
android:id="@+id/freeKm"
style="@style/helveticaRoman15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:minWidth="82dp"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100 vrije km" />
<TextView
android:id="@+id/yearOfConstruction"
style="@style/helveticaRoman15"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:textColor="@color/gray"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintStart_toEndOf="@+id/freeKm"
app:layout_constraintTop_toTopOf="@+id/distance"
app:layout_constraintWidth_max="50dp"
tools:text="bouwjaar" />
<TextView
android:id="@+id/newIndicator"
style="@style/helveticaMedium15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:gravity="center"
android:paddingStart="5dp"
android:paddingTop="3dp"
android:paddingEnd="5dp"
android:paddingBottom="3dp"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
app:layout_constraintTop_toTopOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="thumbImage, numberOfBookings"
tools:layout_editor_absoluteX="411dp" />
<ImageView
android:id="@+id/thumbImage"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:background="@color/yellow"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/distance"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="82dp" />
android android-constraintlayout
android android-constraintlayout
edited Mar 16 at 21:47
Titei
asked Mar 8 at 21:56
TiteiTitei
12
12
1
Hi and welcome... Please see how to ask: stackoverflow.com/help/how-to-ask
– SakoBu
Mar 8 at 22:40
thank you, is this a better question now?
– Titei
Mar 9 at 14:01
Did you actually name the parent layout "parent"? If not, you don't need the id tag for parent. Instead of this: app:layout_constraintTop_toTopOf="@+id/parent", use this: app:layout_constraintTop_toTopOf="parent". Also, the barrier on its own will do nothing, unless you constrain that to the guideline. I would also suggest using percentages instead of hardcoded values and horizontal/vertical biases.
– Nikos Hidalgo
Mar 13 at 11:17
hi thx, no, offcours it should have been just "parent". And yes, i mostly use percentages in my guidelines. I will work on this the coming days and will try to constrain that barrier as you say. I'm not very confident that that will do the tric. I might end up using linear layouts anyway with the tags embedded in them.
– Titei
Mar 16 at 21:50
add a comment |
1
Hi and welcome... Please see how to ask: stackoverflow.com/help/how-to-ask
– SakoBu
Mar 8 at 22:40
thank you, is this a better question now?
– Titei
Mar 9 at 14:01
Did you actually name the parent layout "parent"? If not, you don't need the id tag for parent. Instead of this: app:layout_constraintTop_toTopOf="@+id/parent", use this: app:layout_constraintTop_toTopOf="parent". Also, the barrier on its own will do nothing, unless you constrain that to the guideline. I would also suggest using percentages instead of hardcoded values and horizontal/vertical biases.
– Nikos Hidalgo
Mar 13 at 11:17
hi thx, no, offcours it should have been just "parent". And yes, i mostly use percentages in my guidelines. I will work on this the coming days and will try to constrain that barrier as you say. I'm not very confident that that will do the tric. I might end up using linear layouts anyway with the tags embedded in them.
– Titei
Mar 16 at 21:50
1
1
Hi and welcome... Please see how to ask: stackoverflow.com/help/how-to-ask
– SakoBu
Mar 8 at 22:40
Hi and welcome... Please see how to ask: stackoverflow.com/help/how-to-ask
– SakoBu
Mar 8 at 22:40
thank you, is this a better question now?
– Titei
Mar 9 at 14:01
thank you, is this a better question now?
– Titei
Mar 9 at 14:01
Did you actually name the parent layout "parent"? If not, you don't need the id tag for parent. Instead of this: app:layout_constraintTop_toTopOf="@+id/parent", use this: app:layout_constraintTop_toTopOf="parent". Also, the barrier on its own will do nothing, unless you constrain that to the guideline. I would also suggest using percentages instead of hardcoded values and horizontal/vertical biases.
– Nikos Hidalgo
Mar 13 at 11:17
Did you actually name the parent layout "parent"? If not, you don't need the id tag for parent. Instead of this: app:layout_constraintTop_toTopOf="@+id/parent", use this: app:layout_constraintTop_toTopOf="parent". Also, the barrier on its own will do nothing, unless you constrain that to the guideline. I would also suggest using percentages instead of hardcoded values and horizontal/vertical biases.
– Nikos Hidalgo
Mar 13 at 11:17
hi thx, no, offcours it should have been just "parent". And yes, i mostly use percentages in my guidelines. I will work on this the coming days and will try to constrain that barrier as you say. I'm not very confident that that will do the tric. I might end up using linear layouts anyway with the tags embedded in them.
– Titei
Mar 16 at 21:50
hi thx, no, offcours it should have been just "parent". And yes, i mostly use percentages in my guidelines. I will work on this the coming days and will try to constrain that barrier as you say. I'm not very confident that that will do the tric. I might end up using linear layouts anyway with the tags embedded in them.
– Titei
Mar 16 at 21:50
add a comment |
1 Answer
1
active
oldest
votes
I actually managed quite a bit now to get what i want. @NikosHidalgo thanks for the suggestion about the barrier/guideline. I'll put my code underneath. Unfortunately i do not jet really understand what i did, but it looks good.... – Titei 6 mins ago
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<!--tag1-->
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="1,7 km" />
<!--tag2-->
<TextView
android:id="@+id/freeKm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="12dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxWidth="95dp"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="parent"
tools:text="100 vrije km" />
<!--tag3-->
<TextView
android:id="@+id/yearOfConstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/gray"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/freeKm"
tools:text="plaatsnaam" />
<!--tag4-->
<TextView
android:id="@+id/newIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="distance, freeKm, yearOfConstruction, newIndicator"
app:layout_constraintEnd_toStartOf="@+id/thumbImage"
app:layout_constraintStart_toEndOf="@+id/guideline" />
<!--end image-->
<ImageView
android:id="@+id/thumbImage"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb_up"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<!-- end view-->
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="85dp" />
</android.support.constraint.ConstraintLayout>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071548%2fhow-do-i-correctly-use-2-chains-next-to-eachother-in-constraintlayout-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I actually managed quite a bit now to get what i want. @NikosHidalgo thanks for the suggestion about the barrier/guideline. I'll put my code underneath. Unfortunately i do not jet really understand what i did, but it looks good.... – Titei 6 mins ago
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<!--tag1-->
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="1,7 km" />
<!--tag2-->
<TextView
android:id="@+id/freeKm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="12dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxWidth="95dp"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="parent"
tools:text="100 vrije km" />
<!--tag3-->
<TextView
android:id="@+id/yearOfConstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/gray"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/freeKm"
tools:text="plaatsnaam" />
<!--tag4-->
<TextView
android:id="@+id/newIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="distance, freeKm, yearOfConstruction, newIndicator"
app:layout_constraintEnd_toStartOf="@+id/thumbImage"
app:layout_constraintStart_toEndOf="@+id/guideline" />
<!--end image-->
<ImageView
android:id="@+id/thumbImage"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb_up"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<!-- end view-->
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="85dp" />
</android.support.constraint.ConstraintLayout>
add a comment |
I actually managed quite a bit now to get what i want. @NikosHidalgo thanks for the suggestion about the barrier/guideline. I'll put my code underneath. Unfortunately i do not jet really understand what i did, but it looks good.... – Titei 6 mins ago
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<!--tag1-->
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="1,7 km" />
<!--tag2-->
<TextView
android:id="@+id/freeKm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="12dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxWidth="95dp"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="parent"
tools:text="100 vrije km" />
<!--tag3-->
<TextView
android:id="@+id/yearOfConstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/gray"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/freeKm"
tools:text="plaatsnaam" />
<!--tag4-->
<TextView
android:id="@+id/newIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="distance, freeKm, yearOfConstruction, newIndicator"
app:layout_constraintEnd_toStartOf="@+id/thumbImage"
app:layout_constraintStart_toEndOf="@+id/guideline" />
<!--end image-->
<ImageView
android:id="@+id/thumbImage"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb_up"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<!-- end view-->
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="85dp" />
</android.support.constraint.ConstraintLayout>
add a comment |
I actually managed quite a bit now to get what i want. @NikosHidalgo thanks for the suggestion about the barrier/guideline. I'll put my code underneath. Unfortunately i do not jet really understand what i did, but it looks good.... – Titei 6 mins ago
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<!--tag1-->
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="1,7 km" />
<!--tag2-->
<TextView
android:id="@+id/freeKm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="12dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxWidth="95dp"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="parent"
tools:text="100 vrije km" />
<!--tag3-->
<TextView
android:id="@+id/yearOfConstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/gray"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/freeKm"
tools:text="plaatsnaam" />
<!--tag4-->
<TextView
android:id="@+id/newIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="distance, freeKm, yearOfConstruction, newIndicator"
app:layout_constraintEnd_toStartOf="@+id/thumbImage"
app:layout_constraintStart_toEndOf="@+id/guideline" />
<!--end image-->
<ImageView
android:id="@+id/thumbImage"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb_up"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<!-- end view-->
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="85dp" />
</android.support.constraint.ConstraintLayout>
I actually managed quite a bit now to get what i want. @NikosHidalgo thanks for the suggestion about the barrier/guideline. I'll put my code underneath. Unfortunately i do not jet really understand what i did, but it looks good.... – Titei 6 mins ago
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<!--tag1-->
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/freeKm"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="1,7 km" />
<!--tag2-->
<TextView
android:id="@+id/freeKm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="12dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxWidth="95dp"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/yearOfConstruction"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/distance"
app:layout_constraintTop_toTopOf="parent"
tools:text="100 vrije km" />
<!--tag3-->
<TextView
android:id="@+id/yearOfConstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:autoSizeTextType="uniform"
android:background="@drawable/bg_gray_car_location"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/gray"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/newIndicator"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/freeKm"
tools:text="plaatsnaam" />
<!--tag4-->
<TextView
android:id="@+id/newIndicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="@drawable/bg_gray_car_location"
android:fontFamily="@font/helvetica_neu_bold"
android:autoSizeTextType="uniform"
android:maxLines="1"
android:text="@string/resource_view_free_km"
android:textColor="@color/black"
app:layout_constraintTop_toTopOf="@+id/freeKm"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toEndOf="@+id/yearOfConstruction"
tools:text="nieuw" />
<android.support.constraint.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="start"
app:constraint_referenced_ids="distance, freeKm, yearOfConstruction, newIndicator"
app:layout_constraintEnd_toStartOf="@+id/thumbImage"
app:layout_constraintStart_toEndOf="@+id/guideline" />
<!--end image-->
<ImageView
android:id="@+id/thumbImage"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:gravity="center_vertical"
android:src="@drawable/ic_thumb_up"
android:tint="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/distance"
app:layout_constraintEnd_toStartOf="@+id/numberOfBookings"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="@+id/distance" />
<!-- end view-->
<TextView
android:id="@+id/numberOfBookings"
style="@style/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textSize="@dimen/button_textview"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/freeKm"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/thumbImage"
app:layout_constraintTop_toTopOf="@+id/freeKm"
tools:text="100%" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_end="85dp" />
</android.support.constraint.ConstraintLayout>
answered Mar 17 at 9:06
TiteiTitei
12
12
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55071548%2fhow-do-i-correctly-use-2-chains-next-to-eachother-in-constraintlayout-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Hi and welcome... Please see how to ask: stackoverflow.com/help/how-to-ask
– SakoBu
Mar 8 at 22:40
thank you, is this a better question now?
– Titei
Mar 9 at 14:01
Did you actually name the parent layout "parent"? If not, you don't need the id tag for parent. Instead of this: app:layout_constraintTop_toTopOf="@+id/parent", use this: app:layout_constraintTop_toTopOf="parent". Also, the barrier on its own will do nothing, unless you constrain that to the guideline. I would also suggest using percentages instead of hardcoded values and horizontal/vertical biases.
– Nikos Hidalgo
Mar 13 at 11:17
hi thx, no, offcours it should have been just "parent". And yes, i mostly use percentages in my guidelines. I will work on this the coming days and will try to constrain that barrier as you say. I'm not very confident that that will do the tric. I might end up using linear layouts anyway with the tags embedded in them.
– Titei
Mar 16 at 21:50