Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 3. Layout > Size Children Uniformly - Pg. 91

3.5 Size Children Uniformly Problem You want all children within a container to be the same size. Solution To restrict the size of the child elements within a target container, use the columnHeight and rowHeight properties of HorizontalLayout and VerticalLayout , respectively. To dynamically size and position all children of a target container based on the dimensions of a single child element, use the typicalLayoutElement property. Discussion By default, the variableRowHeight and variableColumnHeight properties of Horizontal Layout and VerticalLayout , respectively, are set to a value of true . This default setting ensures that all child elements are displayed based on their individually measured di- mensions. This can be beneficial when presenting elements that vary in size, but the rendering costs may prove to be a performance burden at runtime. To speed up ren- dering time, Spark layouts have properties for setting static values to ensure that all child elements are sized uniformly. The following example sets the rowHeight and variableRowHeight property values to constrain the height of child elements in a target container using a vertical layout: