AbstractComposeView

Known direct subclasses
ComposeView

A android.view.View that can host Jetpack Compose UI content.


Base class for custom android.view.Views implemented using Jetpack Compose UI. Subclasses should implement the Content function with the appropriate content. Calls to addView and its variants and overloads will fail with IllegalStateException.

By default, the composition is disposed according to ViewCompositionStrategy.Default. Call disposeComposition to dispose of the underlying composition earlier, or if the view is never initially attached to a window. (The requirement to dispose of the composition explicitly in the event that the view is never (re)attached is temporary.)

AbstractComposeView only supports being added into view hierarchies propagating LifecycleOwner and SavedStateRegistryOwner via androidx.lifecycle.setViewTreeLifecycleOwner and androidx.savedstate.setViewTreeSavedStateRegistryOwner. In most cases you will already have it set up correctly as androidx.activity.ComponentActivity, androidx.fragment.app.Fragment and androidx.navigation.NavController will provide the correct values.

Summary

Public constructors

AbstractComposeView(
    context: Context,
    attrs: AttributeSet?,
    defStyleAttr: Int
)
android

Public functions

abstract Unit

The Jetpack Compose UI content for this view.

android
open Unit
addView(child: View?)
android
open Unit
addView(child: View?, index: Int)
android
open Unit
addView(child: View?, params: ViewGroup.LayoutParams?)
android
open Unit
addView(child: View?, index: Int, params: ViewGroup.LayoutParams?)
android
open Unit
addView(child: View?, width: Int, height: Int)
android
Unit

Perform initial composition for this view.

android
Unit

Dispose of the underlying composition and requestLayout.

android
open Boolean
android
open Unit
onRtlPropertiesChanged(layoutDirection: Int)
android
Unit

Set the CompositionContext that should be the parent of this view's composition.

android
open Unit
setTransitionGroup(isTransitionGroup: Boolean)
android
Unit

Set the strategy for managing disposal of this View's internal composition.

android
open Boolean
android

Protected functions

open Boolean
addViewInLayout(child: View?, index: Int, params: ViewGroup.LayoutParams?)
android
open Boolean
addViewInLayout(
    child: View?,
    index: Int,
    params: ViewGroup.LayoutParams?,
    preventRequestLayout: Boolean
)
android
open Unit
android
final Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
android
final Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
android

Public properties

Boolean

true if this View is host to an active Compose UI composition.

android
Boolean

Enables the display of visual layout bounds for the Compose UI content of this view.

android

Protected properties

open Boolean

If true, this View's composition will be created when it becomes attached to a window for the first time.

android

Extension properties

Boolean

Indicates whether access to WindowInsets within the content should consume the Android android.view.WindowInsets.

android

Inherited functions

From android.view.View
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open ViewPropertyAnimator
android
open Unit
android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
Unit
android
open Unit
android
Unit
android
open Boolean
android
open Unit
android
open Unit
android
open Int
android
open Int
android
open Int
android
open Unit
android
open WindowInsets
android
open Int
android
open Int
android
open Int
android
open AccessibilityNodeInfo
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
dispatchNestedPreScroll(p0: Int, p1: Int, p2: IntArray?, p3: IntArray?)
android
open Boolean
dispatchNestedScroll(p0: Int, p1: Int, p2: Int, p3: Int, p4: IntArray?)
android
open Boolean
android
open Unit
draw(p0: Canvas)
android
open Unit
android
OnBackInvokedDispatcher?
android
T
<T : View> findViewById(p0: Int)
android
T
<T : View> findViewWithTag(p0: Any)
android
open Boolean

This function is deprecated. Deprecated in Java

android
open View
android
open Unit
android
open Unit
android
open Unit
generateDisplayHash(
    p0: String,
    p1: Rect?,
    p2: Executor,
    p3: DisplayHashResultCallback
)
android
open View.AccessibilityDelegate
android
open Int
android
open AccessibilityNodeProvider
android
open CharSequence?
android
open Int
android
open Int
android
open String?
android
open String?
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getAlpha()
android
open Animation
android
open Matrix?
android
open IBinder
android
open IntArray
android
open MutableMap<IntInt>
android
open Array<String>?
android
AutofillId
android
open Int
android
open AutofillValue?
android
open Drawable
android
open BlendMode?
android
open ColorStateList?
android
open PorterDuff.Mode?
android
open Int
@ViewDebug.ExportedProperty(category = "layout")
getBaseline()
android
Int
android
open Float
android
open Int
android
open Float
android
open Rect
android
open Boolean
android
Boolean
android
ContentCaptureSession?
android
open CharSequence
@ViewDebug.ExportedProperty(category = "accessibility")
getContentDescription()
android
Context
android
open ContextMenu.ContextMenuInfo
android
Boolean
android
open Display
android
IntArray
android
open Bitmap

This function is deprecated. Deprecated in Java

android
open Bitmap

This function is deprecated. Deprecated in Java

android
open Int

This function is deprecated. Deprecated in Java

android
open Int

This function is deprecated. Deprecated in Java

android
open Unit
android
open Long
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getElevation()
android
open Int
android
open Boolean
android
open Boolean
android
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "NOT_FOCUSABLE"), @ViewDebug.IntToString(from = 1, to = "FOCUSABLE"), @ViewDebug.IntToString(from = 16, to = "FOCUSABLE_AUTO")], category = "focus")
getFocusable()
android
open ArrayList<View>
android
open Unit
android
open Drawable
android
open Int
android
open BlendMode?
android
open ColorStateList?
android
open PorterDuff.Mode?
android
Boolean
android
open Boolean
android
open Handler
android
open Float
android
open Float
android
open Float
android
open Float
android
open Runnable?
android
Boolean
android
Int
@ViewDebug.ExportedProperty(category = "layout")
getHeight()
android
open Unit
android
open Int
android
open Int
android
open Drawable?
android
open Drawable?
android
open Int
android
open Int
@ViewDebug.ExportedProperty(category = "accessibility", mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "noHideDescendants")])
getImportantForAccessibility()
android
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "yesExcludeDescendants"), @ViewDebug.IntToString(from = 8, to = "noExcludeDescendants")])
getImportantForAutofill()
android
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "yesExcludeDescendants"), @ViewDebug.IntToString(from = 8, to = "noExcludeDescendants")])
getImportantForContentCapture()
android
open Boolean
android
open KeyEvent.DispatcherState
android
open Int
@ViewDebug.ExportedProperty(category = "accessibility")
getLabelFor()
android
open Int
android
open Int
@ViewDebug.ExportedProperty(category = "layout", mapping = [@ViewDebug.IntToString(from = 0, to = "RESOLVED_DIRECTION_LTR"), @ViewDebug.IntToString(from = 1, to = "RESOLVED_DIRECTION_RTL")])
getLayoutDirection()
android
open ViewGroup.LayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
getLayoutParams()
android
Int
android
open Float
android
open Int
android
Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Matrix
android
Int
android
Int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredHeightAndState()
android
Int
android
Int
android
Int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredWidthAndState()
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open View.OnFocusChangeListener
android
open Int
android
open ViewOutlineProvider
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
open Int
android
ViewParent
android
open ViewParent
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotX()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotY()
android
open PointerIcon
android
MutableList<Rect>
android
open Array<String>?
android
open Resources
android
Boolean
android
Int
android
open Float
android
open Int
android
open AttachedSurfaceControl?
android
open View
android
open WindowInsets
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotation()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationX()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationY()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleX()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleY()
android
open Int
android
open Int
android
open Int
android
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "INSIDE_OVERLAY"), @ViewDebug.IntToString(from = 16777216, to = "INSIDE_INSET"), @ViewDebug.IntToString(from = 33554432, to = "OUTSIDE_OVERLAY"), @ViewDebug.IntToString(from = 50331648, to = "OUTSIDE_INSET")])
getScrollBarStyle()
android
open Int
android
open Int
android
Int
android
Int
android
open Int
@ViewDebug.ExportedProperty(category = "drawing")
getSolidColor()
android
open Int
android
CharSequence?
@ViewDebug.ExportedProperty(category = "accessibility")
getStateDescription()
android
open StateListAnimator
android
open Int
android
open Int
android
open MutableList<Rect>
android
open Int

This function is deprecated. Deprecated in Java

android
open Any
android
open Any
getTag(p0: Int)
android
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "GRAVITY"), @ViewDebug.IntToString(from = 2, to = "TEXT_START"), @ViewDebug.IntToString(from = 3, to = "TEXT_END"), @ViewDebug.IntToString(from = 4, to = "CENTER"), @ViewDebug.IntToString(from = 5, to = "VIEW_START"), @ViewDebug.IntToString(from = 6, to = "VIEW_END")])
getTextAlignment()
android
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "FIRST_STRONG"), @ViewDebug.IntToString(from = 2, to = "ANY_RTL"), @ViewDebug.IntToString(from = 3, to = "LTR"), @ViewDebug.IntToString(from = 4, to = "RTL"), @ViewDebug.IntToString(from = 5, to = "LOCALE"), @ViewDebug.IntToString(from = 6, to = "FIRST_STRONG_LTR"), @ViewDebug.IntToString(from = 7, to = "FIRST_STRONG_RTL")])
getTextDirection()
android
open CharSequence?
android
Int
android
open Float
android
open Int
android
open TouchDelegate
android
open ArrayList<View>
android
open Float
android
open String
android
open Float
android
open Float
android
open Float
android
open Long
android
open Int
android
open Int
android
open Drawable?
android
open Drawable?
android
open Int
android
open ViewTranslationResponse?
android
open ViewTreeObserver
android
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "VISIBLE"), @ViewDebug.IntToString(from = 4, to = "INVISIBLE"), @ViewDebug.IntToString(from = 8, to = "GONE")])
getVisibility()
android
Int
@ViewDebug.ExportedProperty(category = "layout")
getWidth()
android
open Int
android
open WindowId
android
open WindowInsetsController?
android
open Int

This function is deprecated. Deprecated in Java

android
open IBinder
android
open Int
android
open Unit
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getX()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getY()
android
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getZ()
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
invalidate(p0: Int, p1: Int, p2: Int, p3: Int)

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean

This function is deprecated. Deprecated in Java

android
open Boolean
android
open Boolean
android
Boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocusable()
android
Boolean
android
open Boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocused()
android
Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
Boolean
android
Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
isOpaque()
android
open Boolean
android
open Boolean
android
open Boolean
android
Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
Boolean
android
open Boolean
android
open Boolean
android
Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open View
android
Unit
measure(p0: Int, p1: Int)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open WindowInsets
android
open Unit
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit
android
open InputConnection
android
open Unit
android
open Unit
android
open Unit
android
open Boolean
android
open Unit
android
open Unit
android
Unit
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
onFocusChanged(p0: Boolean, p1: Int, p2: Rect?)
android
open Boolean
android
open Unit
android
open Boolean
android
open Unit
android
open Unit
android
open Boolean
onKeyDown(p0: Int, p1: KeyEvent)
android
open Boolean
android
open Boolean
onKeyMultiple(p0: Int, p1: Int, p2: KeyEvent)
android
open Boolean
onKeyPreIme(p0: Int, p1: KeyEvent)
android
open Boolean
android
open Boolean
onKeyUp(p0: Int, p1: KeyEvent)
android
open Unit
onOverScrolled(p0: Int, p1: Int, p2: Boolean, p3: Boolean)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open ContentInfo?
android
open Unit
android
open Parcelable?
android
open Unit
android
open Unit
onScrollCaptureSearch(
    p0: Rect,
    p1: Point,
    p2: Consumer<ScrollCaptureTarget>
)
android
open Unit
onScrollChanged(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Boolean
android
open Unit
onSizeChanged(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Boolean
overScrollBy(
    p0: Int,
    p1: Int,
    p2: Int,
    p3: Int,
    p4: Int,
    p5: Int,
    p6: Int,
    p7: Int,
    p8: Boolean
)
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open ContentInfo?
android
open Unit
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit
postInvalidate(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
android
open Unit
postInvalidateDelayed(p0: Long, p1: Int, p2: Int, p3: Int, p4: Int)
android
open Unit
android
open Unit
postInvalidateOnAnimation(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
Boolean
android
Boolean
android
Boolean
android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
Unit
android
Unit
android
T
<T : View> requireViewById(p0: Int)
android
open Unit
android
open Unit
android
Unit
saveAttributeDataForStyleable(
    p0: Context,
    p1: IntArray,
    p2: AttributeSet?,
    p3: TypedArray,
    p4: Int,
    p5: Int
)
android
open Unit
android
open Unit
android
open Unit
scrollBy(p0: Int, p1: Int)
android
open Unit
scrollTo(p0: Int, p1: Int)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
setAutofillHints(vararg p0: String?)
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
setId(p0: Int)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
setLayerType(p0: Int, p1: Paint?)
android
open Unit
android
open Unit
android
Unit
setLeft(p0: Int)
android
Unit
setLeftTopRightBottom(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
android
Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
setPadding(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
setPaddingRelative(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
android
open Unit
android
open Unit
android
Unit
android
Unit
android
open Unit
android
open Unit
android
Unit
android
Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
setTag(p0: Any)
android
open Unit
setTag(p0: Int, p1: Any)
android
open Unit
android
open Unit
android
open Unit
android
Unit
setTop(p0: Int)
android
open Unit
android
open Unit
android
Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
setX(p0: Float)
android
open Unit
setY(p0: Float)
android
open Unit
setZ(p0: Float)
android
open Boolean
android
open Boolean
android
open ActionMode
android
open ActionMode
android
open Unit
android
Boolean
startDrag(p0: ClipData, p1: View.DragShadowBuilder, p2: Any, p3: Int)

This function is deprecated. Deprecated in Java

android
Boolean
android
open Boolean
android
open Unit
android
open String
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
Unit
android
open Boolean
android
open Boolean

This function is deprecated. Deprecated in Java

android
open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
willNotDraw()
android
From android.view.ViewGroup
open Unit
android
open Unit
android
open Unit
addFocusables(p0: ArrayList<View>, p1: Int, p2: Int)
android
open Unit
android
open Boolean
android
open Unit
android
open Unit
attachLayoutAnimationParameters(
    p0: View,
    p1: ViewGroup.LayoutParams,
    p2: Int,
    p3: Int
)
android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
debug(p0: Int)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open WindowInsets
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
dispatchScrollCaptureSearch(
    p0: Rect,
    p1: Point,
    p2: Consumer<ScrollCaptureTarget>
)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Boolean
android
open Boolean
android
open Boolean
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open WindowInsets
android
open WindowInsetsAnimation.Bounds
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Boolean
drawChild(p0: Canvas, p1: View, p2: Long)
android
open Unit
android
open Unit
android
open View
android
open OnBackInvokedDispatcher?
android
open Unit
android
open View
focusSearch(p0: View, p1: Int)
android
open Unit
android
open Boolean
android
open ViewGroup.LayoutParams
android
open ViewGroup.LayoutParams
android
open ViewGroup.LayoutParams
android
open CharSequence
android
open View
android
open Int
android
Int
android
open Int
android
open Boolean
android
open Boolean
getChildVisibleRect(p0: View, p1: Rect, p2: Point)
android
open Boolean
android
open Boolean
android
open Int
@ViewDebug.ExportedProperty(category = "focus", mapping = [@ViewDebug.IntToString(from = 131072, to = "FOCUS_BEFORE_DESCENDANTS"), @ViewDebug.IntToString(from = 262144, to = "FOCUS_AFTER_DESCENDANTS"), @ViewDebug.IntToString(from = 393216, to = "FOCUS_BLOCK_DESCENDANTS")])
getDescendantFocusability()
android
open View
android
open LayoutAnimationController
android
open Animation.AnimationListener
android
open Int
android
open LayoutTransition
android
open Int
android
open ViewGroupOverlay
android
open Int
@ViewDebug.ExportedProperty(category = "drawing", mapping = [@ViewDebug.IntToString(from = 0, to = "NONE"), @ViewDebug.IntToString(from = 1, to = "ANIMATION"), @ViewDebug.IntToString(from = 2, to = "SCROLLING"), @ViewDebug.IntToString(from = 3, to = "ALL")])
getPersistentDrawingCache()

This function is deprecated. Deprecated in Java

android
open Boolean
android
open Boolean
android
open Boolean
android
open Int
android
final Unit

This function is deprecated. Deprecated in Java

android
open ViewParent

This function is deprecated. Deprecated in Java

android
open Boolean

This function is deprecated. Deprecated in Java

android
open Boolean

This function is deprecated. Deprecated in Java

android
open Boolean
android
open Boolean

This function is deprecated. Deprecated in Java

android
open Boolean
android
open Boolean
android
open Unit
android
final Unit
layout(p0: Int, p1: Int, p2: Int, p3: Int)
android
open Unit
measureChild(p0: View, p1: Int, p2: Int)
android
open Unit
measureChildWithMargins(p0: View, p1: Int, p2: Int, p3: Int, p4: Int)
android
open Unit
measureChildren(p0: Int, p1: Int)
android
open Unit
android
Unit
android
Unit
android
open IntArray
android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
open Boolean
onNestedFling(p0: View, p1: Float, p2: Float, p3: Boolean)
android
open Boolean
onNestedPreFling(p0: View, p1: Float, p2: Float)
android
open Boolean
android
open Unit
onNestedPreScroll(p0: View, p1: Int, p2: Int, p3: IntArray)
android
open Unit
onNestedScroll(p0: View, p1: Int, p2: Int, p3: Int, p4: Int)
android
open Unit
onNestedScrollAccepted(p0: View, p1: View, p2: Int)
android
open Boolean
android
open Boolean
android
open PointerIcon
android
open Boolean
onStartNestedScroll(p0: View, p1: View, p2: Int)
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
removeViews(p0: Int, p1: Int)
android
open Unit
android
open Unit
android
open Boolean
android
open Unit
android
open Boolean
requestFocus(p0: Int, p1: Rect)
android
open Boolean
android
open Unit
android
open Boolean
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
open Unit

This function is deprecated. Deprecated in Java

android
open Unit
android
open Unit
android
open Unit
android
open Boolean
android
open Boolean
android
open ActionMode
android
open ActionMode
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android

Public constructors

AbstractComposeView

AbstractComposeView(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
)

Public functions

Content

@Composable
@UiComposable
abstract fun Content(): Unit

The Jetpack Compose UI content for this view. Subclasses must implement this method to provide content. Initial composition will occur when the view becomes attached to a window or when createComposition is called, whichever comes first.

addView

open fun addView(child: View?): Unit

addView

open fun addView(child: View?, index: Int): Unit

addView

open fun addView(child: View?, params: ViewGroup.LayoutParams?): Unit

addView

open fun addView(child: View?, index: Int, params: ViewGroup.LayoutParams?): Unit

addView

open fun addView(child: View?, width: Int, height: Int): Unit

createComposition

fun createComposition(): Unit

Perform initial composition for this view. Once this method is called or the view becomes attached to a window, either disposeComposition must be called or the LifecycleOwner returned by findViewTreeLifecycleOwner must reach the Lifecycle.State.DESTROYED state for the composition to be cleaned up properly. (This restriction is temporary.)

If this method is called when the composition has already been created it has no effect.

This method should only be called if this view isAttachedToWindow or if a parent CompositionContext has been set explicitly.

disposeComposition

fun disposeComposition(): Unit

Dispose of the underlying composition and requestLayout. A new composition will be created if createComposition is called or when needed to lay out this view.

isTransitionGroup

open fun isTransitionGroup(): Boolean

onRtlPropertiesChanged

open fun onRtlPropertiesChanged(layoutDirection: Int): Unit

setParentCompositionContext

fun setParentCompositionContext(parent: CompositionContext?): Unit

Set the CompositionContext that should be the parent of this view's composition. If parent is null it will be determined automatically from the window the view is attached to.

setTransitionGroup

open fun setTransitionGroup(isTransitionGroup: Boolean): Unit

setViewCompositionStrategy

fun setViewCompositionStrategy(strategy: ViewCompositionStrategy): Unit

Set the strategy for managing disposal of this View's internal composition. Defaults to ViewCompositionStrategy.Default.

This View's composition is a live resource that must be disposed to ensure that long-lived references to it do not persist

See ViewCompositionStrategy for more information.

shouldDelayChildPressedState

open fun shouldDelayChildPressedState(): Boolean

Protected functions

addViewInLayout

protected open fun addViewInLayout(child: View?, index: Int, params: ViewGroup.LayoutParams?): Boolean

addViewInLayout

protected open fun addViewInLayout(
    child: View?,
    index: Int,
    params: ViewGroup.LayoutParams?,
    preventRequestLayout: Boolean
): Boolean

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onLayout

protected final fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

onMeasure

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

Public properties

hasComposition

val hasCompositionBoolean

true if this View is host to an active Compose UI composition. An active composition may consume resources.

showLayoutBounds

@InternalComposeUiApi
var showLayoutBoundsBoolean

Enables the display of visual layout bounds for the Compose UI content of this view. This is typically configured using the system developer setting for "Show layout bounds."

Protected properties

shouldCreateCompositionOnAttachedToWindow

protected open val shouldCreateCompositionOnAttachedToWindowBoolean

If true, this View's composition will be created when it becomes attached to a window for the first time. Defaults to true.

Subclasses may choose to override this property to prevent this eager initial composition in cases where the view's content is not yet ready. Initial composition will still occur when this view is first measured.

Extension properties

consumeWindowInsets

var AbstractComposeView.consumeWindowInsetsBoolean

Indicates whether access to WindowInsets within the content should consume the Android android.view.WindowInsets. The default value is true, meaning that access to WindowInsets.Companion will consume the Android WindowInsets.

This property should be set prior to first composition.