1

In order to avoid using several nested layouts, I'm making use of a ConstraintLayout.

I have 2 TextView, A and B. A is on top of B. A and B contain some text that is defined by the user. So A can be shorter than B, and B can be shorter than A, at execution time.

I have a Button, C. C is at right of A and at right of B too. I've wrote, for the moment: start_ToEndOf(R.id.A).

The problem: if B is longer than A, C will hide it. What I'm looking for would be a way to tell: "C, your constraint for start is: ToEndOf(R.id.A) if B is shorter than A. Otherwise, it would be: ToEndOf(R.id.B)".

Is it possible using only XML or must I use Java?

JarsOfJam-Scheduler
  • 2,809
  • 3
  • 31
  • 70

1 Answers1

2

That is exactly what a Barrier is for. Have a look at this tutorial to understand how Barriers work.

Rishabh Jain
  • 297
  • 2
  • 13