Skip to main content
Tuoman
Senior II
August 31, 2020
Question

Feature request: constraint based layout

  • August 31, 2020
  • 2 replies
  • 1215 views

This might be in your to-do list in the future already, but I would appreciate this type of feature a lot.

If I want to have dynamic text size fields at the moment, I must write relative positioning for the elements manually.

(aka. element1.setY(element2.getY() + element2.getHeight() + ELEMENT1_2_OFFSET))

Constraint layout features would enable to set position to elements based on other elements.

This topic has been closed for replies.

2 replies

Martin KJELDSEN
Principal III
August 31, 2020

So you're saying you would like a sort of "anchor" for some elements on your view?

Tuoman
TuomanAuthor
Senior II
September 1, 2020

Yes, one element must be anchor, then other elements are positioned in relationship to it, based on its dynamic size and location.

This is common practise in Android UI edition for example:

https://www.youtube.com/watch?v=Ngz5cgLC7m4

I think this can be implemented in parts, and does not need to be full-blown android style editor.

For example simple dropdown selection like

"Relative positon to element: SELECT ELEMENT HERE"

"XY Offset: ENTER OFFSET HERE"

Would be sufficient. Then touchgfx just does the element1.setY(element2.getY() + element2.getHeight() + ELEMENT1_2_OFFSET)) under the hood.

This is useful when the element has dynamic size (e.g. text field), and you want to place object below, right or left of the element regardless of its size.

Martin Stig STISSING
ST Employee
September 1, 2020

@Tuoman​ Thanks a lot for suggesting this.

Would you mind reposting your feature request to the Idea Zone. under the TouchGFX category?

This enables other interested parties in chipping in and voting for your request.

Thanks in advance.

Tuoman
TuomanAuthor
Senior II
September 2, 2020

You got it! Posted.