Google is committed to advancing racial equity for Black communities. See how.

AndroidViewHolder

abstract class AndroidViewHolder : ViewGroup
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.compose.ui.viewinterop.AndroidViewHolder

A base class used to host a View inside Compose. This API is not designed to be used directly, but rather using the AndroidView and AndroidViewBinding APIs, which are built on top of AndroidViewHolder.

Summary

Public constructors
<init>(context: Context)

A base class used to host a View inside Compose.

Public methods
open LayoutParams?

open Unit

Protected methods
open Unit

open Unit

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

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

Inherited extension functions
From androidx.core.view.android.view.ViewGroup
operator Boolean

Returns true if view is found in this view group.

Unit
ViewGroup.forEach(action: (view: View) -> Unit)

Performs the given action on each view in this view group.

Unit
ViewGroup.forEachIndexed(action: (index: Int, view: View) -> Unit)

Performs the given action on each view in this view group, providing its sequential index.

operator View
ViewGroup.get(index: Int)

Returns the view at index.

Boolean

Returns true if this view group contains no views.

Boolean

Returns true if this view group contains one or more views.

operator MutableIterator<View>

Returns a MutableIterator over the views in this view group.

operator Unit

Removes view from this view group.

operator Unit

Adds view to this view group.

From androidx.core.view.android.view.View
Unit
View.doOnAttach(crossinline action: (view: View) -> Unit)

Performs the given action when this view is attached to a window.

Unit
View.doOnDetach(crossinline action: (view: View) -> Unit)

Performs the given action when this view is detached from a window.

Unit
View.doOnLayout(crossinline action: (view: View) -> Unit)

Performs the given action when this view is laid out.

Unit
View.doOnNextLayout(crossinline action: (view: View) -> Unit)

Performs the given action when this view is next laid out.

OneShotPreDrawListener
View.doOnPreDraw(crossinline action: (view: View) -> Unit)

Performs the given action when the view tree is about to be drawn.

Bitmap
View.drawToBitmap(config: Config = Bitmap.Config.ARGB_8888)

Return a Bitmap representation of this View.

Runnable
View.postDelayed(delayInMillis: Long, crossinline action: () -> Unit)

Version of View.postDelayed which re-orders the parameters, allowing the action to be placed outside of parentheses.

Runnable
View.postOnAnimationDelayed(delayInMillis: Long, crossinline action: () -> Unit)

Version of View.postOnAnimationDelayed which re-orders the parameters, allowing the action to be placed outside of parentheses.

Unit
View.setPadding(@Px size: Int)

Sets the view's padding.

Unit

Executes block with the View's layoutParams and reassigns the layoutParams with the updated version.

Unit
View.updateLayoutParams(block: T.() -> Unit)

Executes block with a typed version of the View's layoutParams and reassigns the layoutParams with the updated version.

Unit
View.updatePadding(@Px left: Int = paddingLeft, @Px top: Int = paddingTop, @Px right: Int = paddingRight, @Px bottom: Int = paddingBottom)

Updates this view's padding.

Unit
View.updatePaddingRelative(@Px start: Int = paddingStart, @Px top: Int = paddingTop, @Px end: Int = paddingEnd, @Px bottom: Int = paddingBottom)

Updates this view's relative padding.

From androidx.fragment.app.android.view.View
F

Find a Fragment associated with a View.

From androidx.navigation.android.view.View
NavController

Find a NavController associated with a View.

From androidx.lifecycle.android.view.View
LifecycleOwner?

Locates the LifecycleOwner responsible for managing this View, if present.

ViewModelStoreOwner?

Locates the ViewModelStoreOwner associated with this View, if present.

From androidx.savedstate.android.view.View
SavedStateRegistryOwner?

Locates the SavedStateRegistryOwner associated with this View, if present.

From androidx.compose.ui.platform.android.view.ViewGroup
Composition
ViewGroup.setContent(parent: CompositionReference = Recomposer.current(), content: () -> Unit)

Composes the given composable into the given view.

Composition
ViewGroup.setViewContent(parent: CompositionReference = Recomposer.current(), composable: () -> Unit)

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

Properties
Density

The screen density of the layout.

Modifier

The modifier of the LayoutNode corresponding to this View.

() -> Unit

The update logic of the View.

View?

The view hosted by this holder.

Inherited extension properties
From androidx.core.view.android.view.View
Sequence<View>

Returns a Sequence over this view and its descendants recursively.

Sequence<ViewParent>

Returns a Sequence of the parent chain of this view by repeatedly calling View.getParent.

Boolean

Returns true when this view's visibility is View.GONE, false otherwise.

Boolean

Returns true when this view's visibility is View.INVISIBLE, false otherwise.

Boolean

Returns true when this view's visibility is View.VISIBLE, false otherwise.

Int

Returns the bottom margin if this view's LayoutParams is a ViewGroup.MarginLayoutParams, otherwise 0.

Int

Returns the end margin if this view's LayoutParams is a ViewGroup.MarginLayoutParams, otherwise 0.

Int

Returns the left margin if this view's LayoutParams is a ViewGroup.MarginLayoutParams, otherwise 0.

Int

Returns the right margin if this view's LayoutParams is a ViewGroup.MarginLayoutParams, otherwise 0.

Int

Returns the start margin if this view's LayoutParams is a ViewGroup.MarginLayoutParams, otherwise 0.

Int

Returns the top margin if this view's LayoutParams is a ViewGroup.MarginLayoutParams, otherwise 0.

From androidx.core.view.android.view.ViewGroup
Sequence<View>

Returns a Sequence over the immediate child views in this view group.

Sequence<View>

Returns a Sequence over the child views in this view group recursively.

Int

Returns the number of views in this view group.

Public constructors

<init>

AndroidViewHolder(context: Context)

A base class used to host a View inside Compose. This API is not designed to be used directly, but rather using the AndroidView and AndroidViewBinding APIs, which are built on top of AndroidViewHolder.

Public methods

getLayoutParams

open fun getLayoutParams(): LayoutParams?

requestDisallowInterceptTouchEvent

open fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean): Unit

Protected methods

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onDetachedFromWindow

protected open fun onDetachedFromWindow(): Unit

onLayout

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

onMeasure

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

Properties

density

var density: Density

The screen density of the layout.

modifier

var modifier: Modifier

The modifier of the LayoutNode corresponding to this View.

update

var update: () -> Unit

The update logic of the View.

view

var view: View?

The view hosted by this holder.