Controlling the layout of Elements
I have some general layout questions that I think will be useful for everyone:
Is there anyway to have elements in a view stack on top of each other automatically. This would be useful if you don't know how tall a block of text in a label is going to be and you want another item to always be below it.
is there anyway to get elements to line up next to each other automatically. This is nice if you have a list of labels that need to show up one after another and the length and number of labels is unknown.
So far it seems everything has to be positioned absolutely. I appreciate any help you can offer. Thanks.
2 Answers
-
Accepted Answer
You can solve your first problem by adding
layout:'vertical'
to your view andheight:'auto'
to each of the objects added to the view, usingtop
to specify a margin to act as padding between the objects.See, eg, vertical_layout_basic.js and vertical_layout_table_view.js.
I'm afraid I'm not sure what you mean by the second question. You can use
width:'auto'
and setleft
andright
margins if you want to ensure the edges of the objects line up vertically. -
If you are using Webview, you can use CSS.
If not, I think you can labels, tables, views and set height and width, font, font sizes, etc. to get what you want.