AndroidComposeView

class AndroidComposeView : ViewGroup, Owner, SemanticsTreeProvider, DensityScope
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.ui.core.AndroidComposeView

Summary

Public constructors

<init>(context: Context)

Public methods

Unit

IntPxPosition

Returns the most global position of the owner that Compose can access (such as the device screen).

Unit
callDraw(canvas: Canvas, node: ComponentNode, parentSize: PxSize)

Unit

Observing the model reads can be temporary disabled.

List<SemanticsTreeNode>

Unit

Called by ComponentNode when it is attached to the view system and now has an owner.

Boolean

InputConnection?

Unit

Called by ComponentNode when it is detached from the view system, such as during ComponentNode.emitRemoveAt.

Unit
onEndLayout(layoutNode: LayoutNode)

Called when layout (placement) ends.

Unit
onEndMeasure(layoutNode: LayoutNode)

Called when measure ends.

Unit

Called from a DrawNode, this registers with the underlying view system that a redraw of the given drawNode is required.

Unit

Called by LayoutNode to indicate the new position of layoutNode.

Unit

Unit

Called when some params of RepaintBoundaryNode are updated.

Unit

Called by LayoutNode to request the Owner a new measurement+layout.

Unit
onSizeChange(layoutNode: LayoutNode)

Called by LayoutNode to indicate the new size of layoutNode.

Unit

Called when layout (placement) starts.

Unit

Called when measure starts.

Boolean

Unit

Protected methods

Unit

Boolean
drawChild(canvas: Canvas, child: View, drawingTime: Long)

Unit

Unit

Unit

Unit
onDraw(canvas: Canvas)

Unit
onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int)

Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

Inherited functions

Inherited extension functions

From androidx.ui.layout
Constraints

Creates the Constraints corresponding to the current DpConstraints.

DpConstraints

Creates the DpConstraints corresponding to the current Constraints.

From androidx.compose.android.view.ViewGroup
Unit

Disposes of a composition of the children of this view.

CompositionContext?
ViewGroup.setViewContent(composable: () -> Unit)

Composes the children of the view with the passed in composable.

From androidx.compose.adapters.android.view.View
T
View.getOrAddAdapter(id: Int, factory: () -> T)

ComposeViewAdapter

From androidx.ui.core.android.view.ViewGroup
CompositionContext?
ViewGroup.setContent(content: () -> Unit)

Composes the given composable into the given view.

Properties

Autofill?

AutofillTree

() -> Unit

Constraints

Density

A Density object.

Font.ResourceLoader

Long

Ref<AndroidComposeView>?

LayoutNode

TextInputService

Public constructors

<init>

AndroidComposeView(context: Context)

Public methods

autofill

fun autofill(values: SparseArray<AutofillValue>): Unit

calculatePosition

fun calculatePosition(): IntPxPosition

Returns the most global position of the owner that Compose can access (such as the device screen).

callDraw

fun callDraw(
    canvas: Canvas,
    node: ComponentNode,
    parentSize: PxSize
): Unit

enableModelReadObserving

fun enableModelReadObserving(enabled: Boolean): Unit

Observing the model reads can be temporary disabled. For example if we are currently within the measure stage and we want some code block to be skipped from the observing we disable if before calling the block, execute block and then enable it again.

getAllSemanticNodes

fun getAllSemanticNodes(): List<SemanticsTreeNode>

onAttach

fun onAttach(node: ComponentNode): Unit

Called by ComponentNode when it is attached to the view system and now has an owner. This is used by Owner to update ComponentNode.ownerData and track which nodes are associated with it. It will only be called when node is not already attached to an owner.

onCheckIsTextEditor

fun onCheckIsTextEditor(): Boolean

onCreateInputConnection

fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection?

onDetach

fun onDetach(node: ComponentNode): Unit

Called by ComponentNode when it is detached from the view system, such as during ComponentNode.emitRemoveAt. This will only be called for nodes that are already ComponentNode.attached.

onEndLayout

fun onEndLayout(layoutNode: LayoutNode): Unit

Called when layout (placement) ends.

onEndMeasure

fun onEndMeasure(layoutNode: LayoutNode): Unit

Called when measure ends.

onInvalidate

fun onInvalidate(drawNode: DrawNode): Unit

Called from a DrawNode, this registers with the underlying view system that a redraw of the given drawNode is required. It may cause other nodes to redraw, if necessary.

onPositionChange

fun onPositionChange(layoutNode: LayoutNode): Unit

Called by LayoutNode to indicate the new position of layoutNode. The owner may need to track updated layouts.

onProvideAutofillVirtualStructure

fun onProvideAutofillVirtualStructure(
    structure: ViewStructure?,
    flags: Int
): Unit

onRepaintBoundaryParamsChange

fun onRepaintBoundaryParamsChange(repaintBoundaryNode: RepaintBoundaryNode): Unit

Called when some params of RepaintBoundaryNode are updated. This is not causing re-recording of the RepaintBoundary, but updates params like outline, clipping, elevation or alpha.

onRequestMeasure

fun onRequestMeasure(layoutNode: LayoutNode): Unit

Called by LayoutNode to request the Owner a new measurement+layout.

onSizeChange

fun onSizeChange(layoutNode: LayoutNode): Unit

Called by LayoutNode to indicate the new size of layoutNode. The owner may need to track updated layouts.

onStartLayout

fun onStartLayout(layoutNode: LayoutNode): Unit

Called when layout (placement) starts.

onStartMeasure

fun onStartMeasure(layoutNode: LayoutNode): Unit

Called when measure starts.

onTouchEvent

fun onTouchEvent(event: MotionEvent): Boolean

sendEvent

fun sendEvent(event: MotionEvent): Unit

Protected methods

dispatchDraw

protected fun dispatchDraw(canvas: Canvas): Unit

drawChild

protected fun drawChild(
    canvas: Canvas,
    child: View,
    drawingTime: Long
): Boolean

onAttachedToWindow

protected fun onAttachedToWindow(): Unit

onConfigurationChanged

protected fun onConfigurationChanged(newConfig: Configuration?): Unit

onDetachedFromWindow

protected fun onDetachedFromWindow(): Unit

onDraw

protected fun onDraw(canvas: Canvas): Unit

onLayout

protected fun onLayout(
    changed: Boolean,
    l: Int,
    t: Int,
    r: Int,
    b: Int
): Unit

onMeasure

protected fun onMeasure(
    widthMeasureSpec: Int,
    heightMeasureSpec: Int
): Unit

Properties

autofill

val autofill: Autofill?

autofillTree

val autofillTree: AutofillTree

configurationChangeObserver

var configurationChangeObserver: () -> Unit

constraints

var constraints: Constraints

density

var density: Density

A Density object. Useful if you need to pass it as a param.

fontLoader

val fontLoader: Font.ResourceLoader

measureIteration

var measureIteration: Long

ref

var ref: Ref<AndroidComposeView>?

root

val root: LayoutNode

textInputService

val textInputService: TextInputService