The second Android 11 Developer Preview is now available, test it out and share your feedback.

LayoutTag

@Immutable data class LayoutTag : ParentDataModifier, LayoutTagParentData
kotlin.Any
   ↳ androidx.ui.core.LayoutTag

A ParentDataModifier which tags the target with the given tag. The provided tag will act as parent data, and can be used for example by parent layouts to associate composable children to Measurables when doing layout, as shown below.

Example usage:


//Unresolved: androidx.ui.framework.samples.LayoutTagChildrenUsage

Summary

Public constructors

<init>(tag: Any)

A ParentDataModifier which tags the target with the given tag.

Public methods

Any?

Provides a parentData given the parentData already provided through the modifier's chain.

Inherited extension functions

From androidx.ui.layout
Modifier
Modifier.absolutePadding(left: Dp = 0.dp, top: Dp = 0.dp, right: Dp = 0.dp, bottom: Dp = 0.dp)

Apply additional space along each edge of the content in Dp: left, top, right and bottom.

Modifier

Attempts to size the content to match a specified aspect ratio by trying to match one of the incoming constraints in the following order: Constraints.maxWidth, Constraints.maxHeight, Constraints.minWidth, Constraints.minHeight.

Modifier

Have the content fill the Constraints.maxHeight of the incoming measurement constraints by setting the minimum height to be equal to the maximum height.

Modifier

Have the content fill the Constraints.maxWidth and Constraints.maxHeight of the incoming measurement constraints by setting the minimum width to be equal to the maximum width and the minimum height to be equal to the maximum height.

Modifier

Have the content fill the Constraints.maxWidth of the incoming measurement constraints by setting the minimum width to be equal to the maximum width.

Modifier
Modifier.offset(x: Dp, y: Dp)

Offset the content by (xdp, ydp).

Modifier
Modifier.padding(start: Dp = 0.dp, top: Dp = 0.dp, end: Dp = 0.dp, bottom: Dp = 0.dp)

Apply additional space along each edge of the content in Dp: start, top, end and bottom.

Modifier

Apply alldp of additional space along each edge of the content, left, top, right and bottom.

Modifier

Declare the preferred height of the content to be exactly heightdp.

Modifier
Modifier.preferredHeightIn(minHeight: Dp = Dp.Unspecified, maxHeight: Dp = Dp.Unspecified)

Constrain the height of the content to be between minHeightdp and maxHeightdp as permitted by the incoming measurement Constraints.

Modifier

Declare the preferred size of the content to be exactly sizedp square.

Modifier
Modifier.preferredSize(width: Dp, height: Dp)

Declare the preferred size of the content to be exactly widthdp by heightdp.

Modifier
Modifier.preferredSizeIn(minWidth: Dp = Dp.Unspecified, minHeight: Dp = Dp.Unspecified, maxWidth: Dp = Dp.Unspecified, maxHeight: Dp = Dp.Unspecified)

Constrain the width of the content to be between minWidthdp and maxWidthdp and the height of the content to be between minHeight and maxHeight as permitted by the incoming measurement Constraints.

Modifier

Constrain the size of the content to be within constraints as permitted by the incoming measurement Constraints.

Modifier

Declare the preferred width of the content to be exactly widthdp.

Modifier
Modifier.preferredWidthIn(minWidth: Dp = Dp.Unspecified, maxWidth: Dp = Dp.Unspecified)

Constrain the width of the content to be between minWidthdp and maxWidthdp as permitted by the incoming measurement Constraints.

Modifier

Allow the content to measure at its desired height without regard for the incoming measurement minimum height constraint.

Modifier
Modifier.wrapContentSize(align: Alignment = Center)

Allow the content to measure at its desired size without regard for the incoming measurement minimum width or minimum height constraints.

Modifier
Modifier.wrapContentWidth(align: Alignment = Center)

Allow the content to measure at its desired width without regard for the incoming measurement minimum width constraint.

From androidx.ui.core
Modifier

Clip the content to shape.

Modifier

Clip the content to the bounds of a layer defined at this modifier.

Modifier
Modifier.drawBehind(onDraw: Density.(canvas: Canvas, size: PxSize) -> Unit)

Draw into a Canvas behind the modified content.

Modifier
Modifier.drawLayer(scaleX: Float = 1f, scaleY: Float = 1f, alpha: Float = 1f, translationX: Float = 0f, translationY: Float = 0f, elevation: Float = 0f, rotationX: Float = 0f, rotationY: Float = 0f, rotationZ: Float = 0f, transformOrigin: TransformOrigin = TransformOrigin.Center, outlineShape: Shape? = null, clipToBounds: Boolean = true, clipToOutline: Boolean = true)

Draw the content into a layer.

Modifier

Draw content with modified opacity (alpha) that may be less than 1.

Modifier
Modifier.drawShadow(shape: Shape, elevation: Dp, clipToOutline: Boolean = true, opacity: Float = 1f)

Creates a DrawLayerModifier that draws the shadow.

Modifier
Modifier.onChildPositioned(onChildPositioned: (LayoutCoordinates) -> Unit)

Invoke onChildPositioned with the LayoutCoordinates of each child element after each one is positioned.

Modifier

Invoke onPositioned with the LayoutCoordinates of the element after positioning.

Modifier
Modifier.paint(painter: Painter, sizeToIntrinsics: Boolean = true, alignment: Alignment = Alignment.Center, scaleFit: ScaleFit = ScaleFit.Fit, alpha: Float = DefaultAlpha, colorFilter: ColorFilter? = null, rtl: Boolean = false)

Paint the content using painter.

Modifier

Tag the element with tag to identify the element within its parent.

From androidx.ui.foundation
Modifier

Draws shape with paint behind the content.

Modifier
Modifier.drawBackground(color: Color, shape: Shape = RectangleShape)

Draws shape with a solid color behind the content.

Modifier
Modifier.drawBackground(brush: Brush, shape: Shape = RectangleShape)

Draws shape with brush behind the content.

From androidx.ui.graphics.vector
Modifier
Modifier.drawVector(defaultWidth: Px, defaultHeight: Px, viewportWidth: Float = defaultWidth.value, viewportHeight: Float = defaultHeight.value, tintColor: Color = DefaultTintColor, tintBlendMode: BlendMode = DefaultTintBlendMode, alignment: Alignment = DefaultAlignment, scaleFit: ScaleFit = ScaleFit.Fit, name: String = "", children: VectorScope.(viewportWidth: Float, viewportHeight: Float) -> Unit)

Modifier to draw a vector graphic with the provided width, height and viewport dimensions

From androidx.ui.material.ripple
Modifier
Modifier.ripple(bounded: Boolean = true, radius: Dp? = null, color: Color? = null, enabled: Boolean = true, clock: AnimationClockObservable = AnimationClockAmbient.current)

Ripple is a Modifier which draws the visual indicator for a pressed state.

Properties

Any

Inherited extension properties

From androidx.ui.layout
Modifier

Changes the LayoutDirection of the content to LayoutDirection.Ltr.

Modifier

Changes the LayoutDirection of the content to LayoutDirection.Rtl.

Public constructors

<init>

LayoutTag(tag: Any)

A ParentDataModifier which tags the target with the given tag. The provided tag will act as parent data, and can be used for example by parent layouts to associate composable children to Measurables when doing layout, as shown below.

Example usage:


//Unresolved: androidx.ui.framework.samples.LayoutTagChildrenUsage

Public methods

modifyParentData

fun Density.modifyParentData(parentData: Any?): Any?

Provides a parentData given the parentData already provided through the modifier's chain.

Properties

tag

val tag: Any