MultiSlotLayout
class MultiSlotLayout : LayoutElementBuilders.LayoutElement
Opinionated Tiles layout, row like style with horizontally aligned and spaced slots (for icons or other small content). Should be used as a content passed in to the PrimaryLayout.
Recommended number of added slots is 1 to 3. Their width will be the width of an element passed in, with the MULTI_SLOT_LAYOUT_HORIZONTAL_SPACER_WIDTH space between.
For additional examples and suggested layouts see Tiles Design System.
When accessing the contents of a container for testing, note that this element can't be simply casted back to the original type, i.e.:
MultiSlotLayout msl = new MultiSlotLayout... Box box = new Box.Builder().addContent(msl).build(); MultiSlotLayout myMsl = (MultiSlotLayout) box.getContents().get(0);
To be able to get MultiSlotLayout object from any layout element, fromLayoutElement method should be used, i.e.:
MultiSlotLayout myMsl = MultiSlotLayout.fromLayoutElement(box.getContents().get(0));
Summary
Nested types |
|---|
|
Builder class for |
Public functions |
|
|---|---|
java-static MultiSlotLayout? |
Returns MultiSlotLayout object from the given androidx.wear.tiles.LayoutElementBuilders.LayoutElement (e.g. one retrieved from a container's content with |
@Dimension(unit = 0) Float |
Gets the width of horizontal spacer that is between slots. |
(Mutable)List<LayoutElementBuilders.LayoutElement!> |
Gets the content from this layout, containing all slots that were added. |
Public functions
java-static funfromLayoutElement(element: LayoutElementBuilders.LayoutElement): MultiSlotLayout?
Returns MultiSlotLayout object from the given androidx.wear.tiles.LayoutElementBuilders.LayoutElement (e.g. one retrieved from a container's content with container.getContents().get(index)) if that element can be converted to MultiSlotLayout. Otherwise, it will return null.
fungetHorizontalSpacerWidth(): @Dimension(unit = 0) Float
Gets the width of horizontal spacer that is between slots.
fungetSlotContents(): (Mutable)List<LayoutElementBuilders.LayoutElement!>
Gets the content from this layout, containing all slots that were added.