0

I want to have a layout with a few "sections", each section containing heading and some TextViews, EdiTexts, etc.

I want the sections evenly distributed on the screen, and they can't overlap. So it seems chain is the way to go.

But the problem I always have is how to group some elements in the chain? I don't want to have individual items in each section evenely spaced, I want to have the whole sections evenly spaced. Is it somehow possible? Or will I have to use nested layouts, which pretty much breaks the whole idea of ConstraintLayout?

Pitel
  • 5,334
  • 7
  • 45
  • 72

2 Answers2

0

If you have a fixed number of sections, you can use Guidelines to create the "equidistant demarcations" you want. They are easier to think about that chains and you can see them in the layout editor.

biodun
  • 311
  • 3
  • 5
  • Hmm, another thing. I have the whole layout in ScrollView. And with Guidelines, when the sections start overlapping, it won't start scrolling. But with chains, it does. – Pitel May 28 '19 at 09:04
0

I was able to solve it with ConstraintLayout 2.0's Flow helper.

Pitel
  • 5,334
  • 7
  • 45
  • 72