Align left of the largest view with constraint layout2019 Community Moderator ElectionAndroid : How to programmatically set layout_constraintRight_toRightOf “parent”Fling gesture detection on grid layoutAligning textviews on the left and right edges in Android layoutHow to inflate one view with a layoutHow to align views at the bottom of the screen?Can I underline text in an Android layout?Can the Android Layout folder contain subfolders?Android Drawing Separator/Divider Line in Layout?Android “Only the original thread that created a view hierarchy can touch its views.”What's “tools:context” in Android layout files?Constraint Layout Vertical Align Center
What is the oldest European royal house?
Why is my explanation wrong?
How to educate team mate to take screenshots for bugs with out unwanted stuff
How to recover against Snake as a heavyweight character?
Having the player face themselves after the mid-game
Paper published similar to PhD thesis
How to install "rounded" brake pads
Help! My Character is too much for her story!
Can Witch Sight see through Mirror Image?
Boss Telling direct supervisor I snitched
Draw this image in the TIKZ package
An Undercover Army
Has a sovereign Communist government ever run, and conceded loss, on a fair election?
Inorganic chemistry handbook with reaction lists
Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?
Why is there an extra space when I type "ls" on the Desktop?
Was this cameo in Captain Marvel computer generated?
A vote on the Brexit backstop
Professor forcing me to attend a conference, I can't afford even with 50% funding
What the error in writing this equation by latex?
Can I negotiate a patent idea for a raise, under French law?
Should we avoid writing fiction about historical events without extensive research?
The (Easy) Road to Code
Precision notation for voltmeters
Align left of the largest view with constraint layout
2019 Community Moderator ElectionAndroid : How to programmatically set layout_constraintRight_toRightOf “parent”Fling gesture detection on grid layoutAligning textviews on the left and right edges in Android layoutHow to inflate one view with a layoutHow to align views at the bottom of the screen?Can I underline text in an Android layout?Can the Android Layout folder contain subfolders?Android Drawing Separator/Divider Line in Layout?Android “Only the original thread that created a view hierarchy can touch its views.”What's “tools:context” in Android layout files?Constraint Layout Vertical Align Center
Hi i'm trying to do a view of a schedule.
If the user as is setting into display 24H or not the format of the opening hours change. And Someday the shop is close. The string Closed is dynamic, it can happend everyday it come from VM.days.get(X).time
So here's what i got for the moment:
i want to align the closed to the left of the hour.
Here's my ConstraintLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/base_space">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/small_space"
android:text="@VM.title"
android:textStyle="bold"
tools:text="Heures de la semaine" />
<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="first_time,second_time,third_time,fourth_time,fifth_time,sixth_time" />
<TextView
android:id="@+id/first_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).day"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="Sunday" />
<TextView
android:id="@+id/first_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).time"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintBottom_toBottomOf="@+id/first_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/first_day"
tools:text="8:30 AM - 9:00 PM" />
<TextView
android:id="@+id/second_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).day"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintTop_toBottomOf="@id/first_day"
tools:text="Monday" />
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@+id/second_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/second_day"
tools:text="Closed" />
<TextView
android:id="@+id/third_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).day"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintTop_toBottomOf="@id/second_day"
tools:text="Tuesday" />
<TextView
android:id="@+id/third_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).time"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintBottom_toBottomOf="@+id/third_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/third_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fourth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).day"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintTop_toBottomOf="@id/third_day"
tools:text="Wednesday" />
<TextView
android:id="@+id/fourth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).time"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fourth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fourth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fifth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).day"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintTop_toBottomOf="@id/fourth_day"
tools:text="Thursday" />
<TextView
android:id="@+id/fifth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).time"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fifth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fifth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/sixth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).day"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintTop_toBottomOf="@id/fifth_day"
tools:text="Friday" />
<TextView
android:id="@+id/sixth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).time"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintBottom_toBottomOf="@+id/sixth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/sixth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/seventh_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).day"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintTop_toBottomOf="@id/sixth_day"
tools:text="Saturday" />
<TextView
android:id="@+id/seventh_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).time"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintBottom_toBottomOf="@+id/seventh_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/seventh_day"
tools:text="8:00 - 21:00" />
</android.support.constraint.ConstraintLayout>
I try to put all the timeUI width to 0dp and start at barrier, to parent. But if all the timeUI have thoses constraint they all disapears
android android-layout android-constraintlayout
add a comment |
Hi i'm trying to do a view of a schedule.
If the user as is setting into display 24H or not the format of the opening hours change. And Someday the shop is close. The string Closed is dynamic, it can happend everyday it come from VM.days.get(X).time
So here's what i got for the moment:
i want to align the closed to the left of the hour.
Here's my ConstraintLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/base_space">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/small_space"
android:text="@VM.title"
android:textStyle="bold"
tools:text="Heures de la semaine" />
<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="first_time,second_time,third_time,fourth_time,fifth_time,sixth_time" />
<TextView
android:id="@+id/first_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).day"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="Sunday" />
<TextView
android:id="@+id/first_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).time"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintBottom_toBottomOf="@+id/first_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/first_day"
tools:text="8:30 AM - 9:00 PM" />
<TextView
android:id="@+id/second_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).day"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintTop_toBottomOf="@id/first_day"
tools:text="Monday" />
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@+id/second_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/second_day"
tools:text="Closed" />
<TextView
android:id="@+id/third_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).day"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintTop_toBottomOf="@id/second_day"
tools:text="Tuesday" />
<TextView
android:id="@+id/third_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).time"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintBottom_toBottomOf="@+id/third_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/third_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fourth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).day"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintTop_toBottomOf="@id/third_day"
tools:text="Wednesday" />
<TextView
android:id="@+id/fourth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).time"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fourth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fourth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fifth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).day"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintTop_toBottomOf="@id/fourth_day"
tools:text="Thursday" />
<TextView
android:id="@+id/fifth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).time"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fifth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fifth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/sixth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).day"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintTop_toBottomOf="@id/fifth_day"
tools:text="Friday" />
<TextView
android:id="@+id/sixth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).time"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintBottom_toBottomOf="@+id/sixth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/sixth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/seventh_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).day"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintTop_toBottomOf="@id/sixth_day"
tools:text="Saturday" />
<TextView
android:id="@+id/seventh_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).time"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintBottom_toBottomOf="@+id/seventh_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/seventh_day"
tools:text="8:00 - 21:00" />
</android.support.constraint.ConstraintLayout>
I try to put all the timeUI width to 0dp and start at barrier, to parent. But if all the timeUI have thoses constraint they all disapears
android android-layout android-constraintlayout
add a comment |
Hi i'm trying to do a view of a schedule.
If the user as is setting into display 24H or not the format of the opening hours change. And Someday the shop is close. The string Closed is dynamic, it can happend everyday it come from VM.days.get(X).time
So here's what i got for the moment:
i want to align the closed to the left of the hour.
Here's my ConstraintLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/base_space">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/small_space"
android:text="@VM.title"
android:textStyle="bold"
tools:text="Heures de la semaine" />
<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="first_time,second_time,third_time,fourth_time,fifth_time,sixth_time" />
<TextView
android:id="@+id/first_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).day"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="Sunday" />
<TextView
android:id="@+id/first_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).time"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintBottom_toBottomOf="@+id/first_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/first_day"
tools:text="8:30 AM - 9:00 PM" />
<TextView
android:id="@+id/second_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).day"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintTop_toBottomOf="@id/first_day"
tools:text="Monday" />
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@+id/second_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/second_day"
tools:text="Closed" />
<TextView
android:id="@+id/third_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).day"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintTop_toBottomOf="@id/second_day"
tools:text="Tuesday" />
<TextView
android:id="@+id/third_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).time"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintBottom_toBottomOf="@+id/third_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/third_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fourth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).day"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintTop_toBottomOf="@id/third_day"
tools:text="Wednesday" />
<TextView
android:id="@+id/fourth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).time"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fourth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fourth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fifth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).day"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintTop_toBottomOf="@id/fourth_day"
tools:text="Thursday" />
<TextView
android:id="@+id/fifth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).time"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fifth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fifth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/sixth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).day"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintTop_toBottomOf="@id/fifth_day"
tools:text="Friday" />
<TextView
android:id="@+id/sixth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).time"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintBottom_toBottomOf="@+id/sixth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/sixth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/seventh_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).day"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintTop_toBottomOf="@id/sixth_day"
tools:text="Saturday" />
<TextView
android:id="@+id/seventh_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).time"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintBottom_toBottomOf="@+id/seventh_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/seventh_day"
tools:text="8:00 - 21:00" />
</android.support.constraint.ConstraintLayout>
I try to put all the timeUI width to 0dp and start at barrier, to parent. But if all the timeUI have thoses constraint they all disapears
android android-layout android-constraintlayout
Hi i'm trying to do a view of a schedule.
If the user as is setting into display 24H or not the format of the opening hours change. And Someday the shop is close. The string Closed is dynamic, it can happend everyday it come from VM.days.get(X).time
So here's what i got for the moment:
i want to align the closed to the left of the hour.
Here's my ConstraintLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/base_space">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/small_space"
android:text="@VM.title"
android:textStyle="bold"
tools:text="Heures de la semaine" />
<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="first_time,second_time,third_time,fourth_time,fifth_time,sixth_time" />
<TextView
android:id="@+id/first_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).day"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintTop_toBottomOf="@id/title"
tools:text="Sunday" />
<TextView
android:id="@+id/first_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(0).time"
android:textColor="@VM.days.get(0).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(0).isBold"
app:layout_constraintBottom_toBottomOf="@+id/first_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/first_day"
tools:text="8:30 AM - 9:00 PM" />
<TextView
android:id="@+id/second_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).day"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintTop_toBottomOf="@id/first_day"
tools:text="Monday" />
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@+id/second_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/second_day"
tools:text="Closed" />
<TextView
android:id="@+id/third_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).day"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintTop_toBottomOf="@id/second_day"
tools:text="Tuesday" />
<TextView
android:id="@+id/third_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(2).time"
android:textColor="@VM.days.get(2).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(2).isBold"
app:layout_constraintBottom_toBottomOf="@+id/third_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/third_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fourth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).day"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintTop_toBottomOf="@id/third_day"
tools:text="Wednesday" />
<TextView
android:id="@+id/fourth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(3).time"
android:textColor="@VM.days.get(3).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(3).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fourth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fourth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/fifth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).day"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintTop_toBottomOf="@id/fourth_day"
tools:text="Thursday" />
<TextView
android:id="@+id/fifth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(4).time"
android:textColor="@VM.days.get(4).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(4).isBold"
app:layout_constraintBottom_toBottomOf="@+id/fifth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/fifth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/sixth_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).day"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintTop_toBottomOf="@id/fifth_day"
tools:text="Friday" />
<TextView
android:id="@+id/sixth_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(5).time"
android:textColor="@VM.days.get(5).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(5).isBold"
app:layout_constraintBottom_toBottomOf="@+id/sixth_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/sixth_day"
tools:text="8:00 - 21:00" />
<TextView
android:id="@+id/seventh_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).day"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintTop_toBottomOf="@id/sixth_day"
tools:text="Saturday" />
<TextView
android:id="@+id/seventh_time"
app:layout_constraintLeft_toLeftOf="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(6).time"
android:textColor="@VM.days.get(6).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(6).isBold"
app:layout_constraintBottom_toBottomOf="@+id/seventh_day"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/barrier"
app:layout_constraintTop_toTopOf="@+id/seventh_day"
tools:text="8:00 - 21:00" />
</android.support.constraint.ConstraintLayout>
I try to put all the timeUI width to 0dp and start at barrier, to parent. But if all the timeUI have thoses constraint they all disapears
android android-layout android-constraintlayout
android android-layout android-constraintlayout
edited 2 days ago
JCDecary
asked 2 days ago
JCDecaryJCDecary
3451314
3451314
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
There is many solutions for this:
1- Use a FrameLayout with 2 vertical LinearLayouts (positions start and end)
2- If you insist on using constraint layout, you can try to give a width to the textviews (specially on the right)
3- I am really not sure what will happen but you can try to make the closed one width match_parent instead of wrap_content
1
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
add a comment |
Removed the right/end constraint from the "closed" view. That will left-align it:
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@id/second_day"
app:layout_constraintStart_toStartOf="@id/barrier"
app:layout_constraintTop_toTopOf="@id/second_day"
tools:text="Closed" />
Also, decide using between left/right and start/end constraints. Having both is redundant. Furthermore, when you're referencing a view, there's no need to include the "+" sign in its name.
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
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%2f55023398%2falign-left-of-the-largest-view-with-constraint-layout%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is many solutions for this:
1- Use a FrameLayout with 2 vertical LinearLayouts (positions start and end)
2- If you insist on using constraint layout, you can try to give a width to the textviews (specially on the right)
3- I am really not sure what will happen but you can try to make the closed one width match_parent instead of wrap_content
1
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
add a comment |
There is many solutions for this:
1- Use a FrameLayout with 2 vertical LinearLayouts (positions start and end)
2- If you insist on using constraint layout, you can try to give a width to the textviews (specially on the right)
3- I am really not sure what will happen but you can try to make the closed one width match_parent instead of wrap_content
1
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
add a comment |
There is many solutions for this:
1- Use a FrameLayout with 2 vertical LinearLayouts (positions start and end)
2- If you insist on using constraint layout, you can try to give a width to the textviews (specially on the right)
3- I am really not sure what will happen but you can try to make the closed one width match_parent instead of wrap_content
There is many solutions for this:
1- Use a FrameLayout with 2 vertical LinearLayouts (positions start and end)
2- If you insist on using constraint layout, you can try to give a width to the textviews (specially on the right)
3- I am really not sure what will happen but you can try to make the closed one width match_parent instead of wrap_content
answered 2 days ago
KarimKarim
1013
1013
1
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
add a comment |
1
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
1
1
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
I when with your solution, i did a linearLayout, with 3 view ( wrap / weigh 1 / wrap)
– JCDecary
2 days ago
add a comment |
Removed the right/end constraint from the "closed" view. That will left-align it:
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@id/second_day"
app:layout_constraintStart_toStartOf="@id/barrier"
app:layout_constraintTop_toTopOf="@id/second_day"
tools:text="Closed" />
Also, decide using between left/right and start/end constraints. Having both is redundant. Furthermore, when you're referencing a view, there's no need to include the "+" sign in its name.
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
add a comment |
Removed the right/end constraint from the "closed" view. That will left-align it:
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@id/second_day"
app:layout_constraintStart_toStartOf="@id/barrier"
app:layout_constraintTop_toTopOf="@id/second_day"
tools:text="Closed" />
Also, decide using between left/right and start/end constraints. Having both is redundant. Furthermore, when you're referencing a view, there's no need to include the "+" sign in its name.
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
add a comment |
Removed the right/end constraint from the "closed" view. That will left-align it:
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@id/second_day"
app:layout_constraintStart_toStartOf="@id/barrier"
app:layout_constraintTop_toTopOf="@id/second_day"
tools:text="Closed" />
Also, decide using between left/right and start/end constraints. Having both is redundant. Furthermore, when you're referencing a view, there's no need to include the "+" sign in its name.
Removed the right/end constraint from the "closed" view. That will left-align it:
<TextView
android:id="@+id/second_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@VM.days.get(1).time"
android:textColor="@VM.days.get(1).highlight ? @color/red : @color/gray"
app:isBold="@VM.days.get(1).isBold"
app:layout_constraintBottom_toBottomOf="@id/second_day"
app:layout_constraintStart_toStartOf="@id/barrier"
app:layout_constraintTop_toTopOf="@id/second_day"
tools:text="Closed" />
Also, decide using between left/right and start/end constraints. Having both is redundant. Furthermore, when you're referencing a view, there's no need to include the "+" sign in its name.
edited 2 days ago
answered 2 days ago
Nikos HidalgoNikos Hidalgo
1,1781318
1,1781318
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
add a comment |
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
the closed view is dynamic it may change it's determine by VM.days.get(1).time
– JCDecary
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
Wouldnt it is more easy to just change the text of the text view to close with this color?
– Tamir Abutbul
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
@JCDecary you can change your constraint programmatically depending on the value of the textview (many threads here offer a solution for that - eg stackoverflow.com/questions/41670618/… ). As long as you have both the start and end constraints set, your text will be appearing in the middle.
– Nikos Hidalgo
2 days ago
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%2f55023398%2falign-left-of-the-largest-view-with-constraint-layout%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