Add Alignment Property to Components

Hello @MIT, Current App Inventor System does not have alignment property to adjust components on screen. So will it be possible to add Alignment Property to components.

What exactly do you mean by alignment in this context? Alignment is usually done in the context of something else. In App Inventor, that “something else” is the parent container. Screen (Form) and the Horizontal and Vertical arrangements all have properties for aligning their children. Can you give a specific use case that demonstrates the viability of what you’re proposing?

@ewpatton It is absolutely valid that Alignment is done in parent container. But suppose we add three different components to screen(say button, checkbox, label), when we apply Center Horizontal alignment to this components then all three components are aligned to center, but what if we want to align two components to the right and one to the left, then we will have to add layout for every component. So instead of doing it we can add alignment property to every component such as Android supports alignments to every widgets.

@ewpatton Do you think it is valid ?

The real challenge is that it won’t make sense in all circumstances. We ran into a similar issue when working on the AbsoluteArrangement where we wanted X-Y properties to be shown conditionally when the component was in the absolute arrangement. We would need a way for arrangements to declare that they support arranging their children in this way (e.g., it doesn’t make sense in a TableArrangement), and it will further complicate the logic internally for managing arrangements.

An alternative approach in this case that can be done today with App Inventor is to choose the alignment that makes the most sense for the children of the arrangement, and for any where you need to override this place another arrangement, fill the parent along the perpendicular axis, and have the child arrangement provide the new alignment.

2 Likes