{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ComposeView

public final class ComposeView extends AbstractComposeView

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.compose.ui.platform.AbstractComposeView
         ↳ androidx.compose.ui.platform.ComposeView

A android.view.View that can host Jetpack Compose UI content. Use setContent to supply the content composable function for the view.

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.)

Summary

Public constructors

ComposeView(
    @NonNull Context context,
    AttributeSet attrs,
    int defStyleAttr
)

Public methods

void

The Jetpack Compose UI content for this view.

@NonNull CharSequence
final void
setContent(@Composable @NonNull Function0<Unit> content)

Set the Jetpack Compose UI content for this view.

Protected methods

boolean

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

Extension functions

final boolean

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

final void
WindowInsetsKt.setConsumeWindowInsets(
    @NonNull ComposeView receiver,
    boolean consumeWindowInsets
)

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

Inherited fields

From android.view.View
final @NonNull String[]
@ViewDebug.ExportedProperty(category = "attributes", hasAdjacentMapping = true)
mAttributes
final int
@ViewDebug.ExportedProperty(category = "layout")
@UnsupportedAppUsage(maxTargetSdk = 28)
mBottom
final boolean
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
mCachingFailed
final @NonNull Context
final @NonNull Animation
final @NonNull InputEventConsistencyVerifier
final @NonNull ViewGroup.LayoutParams
@UnsupportedAppUsage(maxTargetSdk = 28)
mLayoutParams
final int
@ViewDebug.ExportedProperty(category = "layout")
@UnsupportedAppUsage(maxTargetSdk = 28)
mLeft
final int
final int
final int
final int
final @NonNull ViewParent
@UnsupportedAppUsage(maxTargetSdk = 28)
mParent
final int
@ViewDebug.ExportedProperty(flagMapping = [@ViewDebug.FlagToString(mask = 4096, equals = 4096, name = "FORCE_LAYOUT"), @ViewDebug.FlagToString(mask = 8192, equals = 8192, name = "LAYOUT_REQUIRED"), @ViewDebug.FlagToString(mask = 32768, equals = 32768, name = "DRAWING_CACHE_INVALID", outputIf = false), @ViewDebug.FlagToString(mask = 32, equals = 32, name = "DRAWN", outputIf = true), @ViewDebug.FlagToString(mask = 32, equals = 32, name = "NOT_DRAWN", outputIf = false), @ViewDebug.FlagToString(mask = 2097152, equals = 2097152, name = "DIRTY")], formatToHexString = true)
@UnsupportedAppUsage(maxTargetSdk = 28, trackingBug = 123769414)
mPrivateFlags
final int
@ViewDebug.ExportedProperty(category = "layout")
@UnsupportedAppUsage(maxTargetSdk = 28)
mRight
final int
@ViewDebug.ExportedProperty(category = "scrolling")
@UnsupportedAppUsage(maxTargetSdk = 28)
mScrollX
final int
@ViewDebug.ExportedProperty(category = "scrolling")
@UnsupportedAppUsage(maxTargetSdk = 28)
mScrollY
final @NonNull Object
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
mTag
final int
@ViewDebug.ExportedProperty(category = "layout")
@UnsupportedAppUsage(maxTargetSdk = 28)
mTop
final @NonNull View.TransformationInfo
final int
final int
final int
From android.view.ViewGroup
final @NonNull ArrayList<@NonNull View>
final int
@ViewDebug.ExportedProperty(flagMapping = [@ViewDebug.FlagToString(mask = 1, equals = 1, name = "CLIP_CHILDREN"), @ViewDebug.FlagToString(mask = 2, equals = 2, name = "CLIP_TO_PADDING"), @ViewDebug.FlagToString(mask = 32, equals = 32, name = "PADDING_NOT_NULL")], formatToHexString = true)
@UnsupportedAppUsage(maxTargetSdk = 28, trackingBug = 123769411)
mGroupFlags
final @NonNull ViewGroup.OnHierarchyChangeListener
@UnsupportedAppUsage(maxTargetSdk = 28, trackingBug = 123768704)
mOnHierarchyChangeListener
final int

Inherited methods

From androidx.compose.ui.platform.AbstractComposeView
void
addView(View child)
void
addView(View child, int index)
void
void
addView(View child, int index, ViewGroup.LayoutParams params)
void
addView(View child, int width, int height)
boolean
addViewInLayout(View child, int index, ViewGroup.LayoutParams params)
boolean
addViewInLayout(
    View child,
    int index,
    ViewGroup.LayoutParams params,
    boolean preventRequestLayout
)
final void

Perform initial composition for this view.

final void

Dispose of the underlying composition and requestLayout.

final boolean

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

final boolean

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

boolean
void
final void
onLayout(boolean changed, int left, int top, int right, int bottom)
final void
onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void
onRtlPropertiesChanged(int layoutDirection)
final void

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

final void
setShowLayoutBounds(@InternalComposeUiApi boolean showLayoutBounds)

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

void
setTransitionGroup(boolean isTransitionGroup)
final void

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

boolean
From org.robolectric.internal.bytecode.ShadowedObject
From android.view.View
void
void
void
void
void
@NonNull ViewPropertyAnimator
void
void
void
void
boolean
boolean
boolean
awakenScrollBars(int p0, boolean p1)
void
void

This method is deprecated. Deprecated in Java

void
buildDrawingCache(boolean p0)

This method is deprecated. Deprecated in Java

void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
void
void
boolean
void
void
void
void
void
boolean

This method is deprecated. Deprecated in Java

int
int
int
void
void
@NonNull WindowInsets
int
int
int
@NonNull AccessibilityNodeInfo
@NonNull AccessibilityNodeInfo
void
@NonNull ScrollCaptureCallback
void
void
void

This method is deprecated. Deprecated in Java

boolean
void
boolean
dispatchNestedFling(float p0, float p1, boolean p2)
boolean
dispatchNestedPreFling(float p0, float p1)
boolean
boolean
dispatchNestedPreScroll(int p0, int p1, @NonNull int[] p2, @NonNull int[] p3)
boolean
dispatchNestedScroll(int p0, int p1, int p2, int p3, @NonNull int[] p4)
boolean
boolean
void
void
drawableHotspotChanged(float p0, float p1)
boolean
void
@NonNull OnBackInvokedDispatcher
@NonNull T
<T extends View> findViewById(int p0)
@NonNull T
@NonNull T
<T extends View> findViewByPredicateInsideOut(
    @NonNull View p0,
    @NonNull Predicate<@NonNull View> p1
)
@NonNull T
<T extends View> findViewWithTag(@NonNull Object p0)
void
boolean

This method is deprecated. Deprecated in Java

boolean
@NonNull View
focusSearch(int p0)
void
void
void
generateDisplayHash(
    @NonNull String p0,
    @NonNull Rect p1,
    @NonNull Executor p2,
    @NonNull DisplayHashResultCallback p3
)
@NonNull View.AccessibilityDelegate
int
@NonNull AccessibilityNodeProvider
@NonNull CharSequence
int
int
int
int
int
int
float
@ViewDebug.ExportedProperty(category = "drawing")
getAlpha()
@NonNull Animation
@NonNull Matrix
@NonNull IBinder
@NonNull int[]
@NonNull Map<@NonNull Integer, @NonNull Integer>
@NonNull String[]
@NonNull AutofillId
int
@NonNull AutofillValue
int
@NonNull Drawable
@NonNull BlendMode
@NonNull ColorStateList
@NonNull PorterDuff.Mode
int
@ViewDebug.ExportedProperty(category = "layout")
getBaseline()
int
float
int
void
void
getBoundsOnScreen(@NonNull Rect p0, boolean p1)
void
getBoundsOnScreen(@NonNull RectF p0, boolean p1)
float
@NonNull Rect
boolean
boolean
@NonNull ContentCaptureSession
@NonNull CharSequence
@ViewDebug.ExportedProperty(category = "accessibility")
getContentDescription()
@NonNull Context
@NonNull ContextMenu.ContextMenuInfo
boolean
@NonNull Display
@NonNull int[]
@NonNull Bitmap

This method is deprecated. Deprecated in Java

@NonNull Bitmap
getDrawingCache(boolean p0)

This method is deprecated. Deprecated in Java

int

This method is deprecated. Deprecated in Java

int

This method is deprecated. Deprecated in Java

void
long
float
@ViewDebug.ExportedProperty(category = "drawing")
getElevation()
int
int
getFadeHeight(boolean p0)
int
getFadeTop(boolean p0)
int
int
boolean
boolean
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()
@NonNull ArrayList<@NonNull View>
getFocusables(int p0)
void
@NonNull Drawable
int
@NonNull BlendMode
@NonNull ColorStateList
@NonNull PorterDuff.Mode
boolean
boolean
@NonNull Handler
@NonNull Rect
boolean
int
@ViewDebug.ExportedProperty(category = "layout")
getHeight()
void
int
float
int
@NonNull Drawable
@NonNull Drawable
void
int
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()
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()
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()
@NonNull Matrix
@NonNull CharSequence
@NonNull AccessibilityIterators.TextSegmentIterator
boolean
@NonNull KeyEvent.DispatcherState
int
@ViewDebug.ExportedProperty(category = "accessibility")
getLabelFor()
int
int
@ViewDebug.ExportedProperty(category = "layout", mapping = [@ViewDebug.IntToString(from = 0, to = "RESOLVED_DIRECTION_LTR"), @ViewDebug.IntToString(from = 1, to = "RESOLVED_DIRECTION_RTL")])
getLayoutDirection()
@NonNull ViewGroup.LayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
getLayoutParams()
int
float
int
boolean
void
void
@NonNull int[]
@ViewDebug.ExportedProperty(category = "layout", indexMapping = [@ViewDebug.IntToString(from = 0, to = "x"), @ViewDebug.IntToString(from = 1, to = "y")])
getLocationOnScreen()
void
@NonNull Matrix
int
int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredHeightAndState()
int
int
int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredWidthAndState()
int
int
int
int
int
int
int
int
boolean
@NonNull View.OnFocusChangeListener
@NonNull View.OnLongClickListener
@NonNull Insets
int
@NonNull ViewOutlineProvider
int
int
int
int
int
int
int
int
@NonNull ViewParent
@NonNull ViewParent
float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotX()
float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotY()
@NonNull PointerIcon
@NonNull List<@NonNull Rect>
int
@ViewDebug.ExportedProperty(category = "layout", mapping = [@ViewDebug.IntToString(from = 0, to = "LTR"), @ViewDebug.IntToString(from = 1, to = "RTL"), @ViewDebug.IntToString(from = 2, to = "INHERIT"), @ViewDebug.IntToString(from = 3, to = "LOCALE")])
getRawLayoutDirection()
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")])
getRawTextAlignment()
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")])
getRawTextDirection()
@NonNull String[]
@NonNull Resources
boolean
int
float
int
@NonNull AttachedSurfaceControl
@NonNull View
@NonNull WindowInsets
float
@ViewDebug.ExportedProperty(category = "drawing")
getRotation()
float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationX()
float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationY()
float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleX()
float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleY()
int
int
int
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()
int
int
int
int
int
@ViewDebug.ExportedProperty(category = "drawing")
getSolidColor()
int
@NonNull CharSequence
@ViewDebug.ExportedProperty(category = "accessibility")
getStateDescription()
@NonNull StateListAnimator
int
int
@NonNull List<@NonNull Rect>
int

This method is deprecated. Deprecated in Java

@NonNull Object
@NonNull Object
getTag(int p0)
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()
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()
@NonNull ThreadedRenderer
@NonNull CharSequence
@NonNull CharSequence
@NonNull View
int
float
int
@NonNull TouchDelegate
@NonNull ArrayList<@NonNull View>
float
@NonNull String
float
float
float
long
@NonNull List<@NonNull Rect>
int
float
int
@NonNull Drawable
@NonNull Drawable
int
@NonNull ViewRootImpl
@NonNull ViewTranslationCallback
@NonNull ViewTranslationResponse
@NonNull ViewTreeObserver
int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "VISIBLE"), @ViewDebug.IntToString(from = 4, to = "INVISIBLE"), @ViewDebug.IntToString(from = 8, to = "GONE")])
getVisibility()
int
@ViewDebug.ExportedProperty(category = "layout")
getWidth()
@NonNull IWindow
int
void
@NonNull WindowId
@NonNull WindowInsetsController
int

This method is deprecated. Deprecated in Java

@NonNull IBinder
int
void
float
@ViewDebug.ExportedProperty(category = "drawing")
getX()
float
@ViewDebug.ExportedProperty(category = "drawing")
getY()
float
@ViewDebug.ExportedProperty(category = "drawing")
getZ()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
@ViewDebug.ExportedProperty(category = "drawing")
hasShadow()
boolean
boolean
boolean
boolean
void
void
void
void
void
void
invalidate(boolean p0)
void

This method is deprecated. Deprecated in Java

void
invalidate(int p0, int p1, int p2, int p3)

This method is deprecated. Deprecated in Java

void
void
void
void
void
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean

This method is deprecated. Deprecated in Java

boolean
boolean
boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocusable()
boolean
boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocused()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
@ViewDebug.ExportedProperty(category = "layout")
isLayoutRtl()
boolean
boolean
boolean
@ViewDebug.ExportedProperty(category = "drawing")
isOpaque()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
@NonNull View
void
void
measure(int p0, int p1)
void
void
void
void
void
onActivityResult(int p0, int p1, @NonNull Intent p2)
void
void
@NonNull WindowInsets
void
boolean
boolean
void
void
void
@NonNull InputConnection
void
void
void
void
onDisplayHint(int p0)
boolean
void
void
void
onDrawHorizontalScrollBar(
    @NonNull Canvas p0,
    @NonNull Drawable p1,
    int p2,
    int p3,
    int p4,
    int p5
)
void
void
onDrawVerticalScrollBar(
    @NonNull Canvas p0,
    @NonNull Drawable p1,
    int p2,
    int p3,
    int p4,
    int p5
)
boolean
void
void
void
onFocusChanged(boolean p0, int p1, @NonNull Rect p2)
void
boolean
void
onHoverChanged(boolean p0)
boolean
void
void
void
void
void
boolean
onKeyDown(int p0, @NonNull KeyEvent p1)
boolean
boolean
onKeyMultiple(int p0, int p1, @NonNull KeyEvent p2)
boolean
onKeyPreIme(int p0, @NonNull KeyEvent p1)
boolean
boolean
onKeyUp(int p0, @NonNull KeyEvent p1)
void
void
onOverScrolled(int p0, int p1, boolean p2, boolean p3)
void
void
void
void
void
void
void
void
onProvideStructure(@NonNull ViewStructure p0, int p1, int p2)
void
@NonNull ContentInfo
void
void
@NonNull Parcelable
void
void
void
onScrollChanged(int p0, int p1, int p2, int p3)
boolean
onSetAlpha(int p0)
void
onSizeChanged(int p0, int p1, int p2, int p3)
void
void
boolean
boolean
void
void
void
void
void
void

This method is deprecated. Deprecated in Java

void
void
outputDirtyFlags(@NonNull String p0, boolean p1, int p2)
boolean
overScrollBy(
    int p0,
    int p1,
    int p2,
    int p3,
    int p4,
    int p5,
    int p6,
    int p7,
    boolean p8
)
boolean
boolean
boolean
boolean
boolean
boolean
performContextClick(float p0, float p1)
boolean
boolean
performHapticFeedback(int p0, int p1)
boolean
boolean
performLongClick(float p0, float p1)
@NonNull ContentInfo
void
boolean
pointInView(float p0, float p1, float p2)
boolean
boolean
postDelayed(@NonNull Runnable p0, long p1)
void
void
postInvalidate(int p0, int p1, int p2, int p3)
void
void
postInvalidateDelayed(long p0, int p1, int p2, int p3, int p4)
void
void
postInvalidateOnAnimation(int p0, int p1, int p2, int p3)
void
void
void
void
void
void
boolean
void
void
void
void
boolean
void
void

This method is deprecated. Deprecated in Java

boolean
boolean
requestFocus(int p0)
boolean
void
void
void
boolean
boolean
void
void
@NonNull T
<T extends View> requireViewById(int p0)
void
void
void
void
void
saveAttributeDataForStyleable(
    @NonNull Context p0,
    @NonNull int[] p1,
    @NonNull AttributeSet p2,
    @NonNull TypedArray p3,
    int p4,
    int p5
)
void
void
void
scrollBy(int p0, int p1)
void
scrollTo(int p0, int p1)
void
void
void
void
void
void
void
void
void
setAccessibilitySelection(int p0, int p1)
void
void
void
setActivated(boolean p0)
void
void
void
void
void
setAssistBlocked(boolean p0)
void
void
void
void
setAutofilled(boolean p0, boolean p1)
void
void
void

This method is deprecated. Deprecated in Java

void
void
void
void
void
setBottom(int p0)
void
void
setClickable(boolean p0)
void
void
void
void
void
setContextClickable(boolean p0)
void
void
setDetached(boolean p0)
void
void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
void
void
void
void
void
void
void
void
void
void
void
setForceDarkAllowed(boolean p0)
void
void
void
void
void
boolean
setFrame(int p0, int p1, int p2, int p3)
void
void
void
void
void
void
void
void
void
setHovered(boolean p0)
void
setId(int p0)
void
void
void
void
setIsRootNamespace(boolean p0)
void
setKeepScreenOn(boolean p0)
void
void
void
void
setLayerType(int p0, @NonNull Paint p1)
void
void
void
setLeft(int p0)
void
setLeftTopRightBottom(int p0, int p1, int p2, int p3)
void
setLongClickable(boolean p0)
void
setMeasuredDimension(int p0, int p1)
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void

This method is deprecated. Deprecated in Java

void
void
void
void
void
void
void
setPadding(int p0, int p1, int p2, int p3)
void
setPaddingRelative(int p0, int p1, int p2, int p3)
void
void
void
void
setPreferKeepClear(boolean p0)
void
void
setPressed(boolean p0)
void
void
setRevealClip(boolean p0, float p1, float p2, float p3)
void
void
setRight(int p0)
void
void
void
void
setSaveEnabled(boolean p0)
void
void
void
void
void
void
void
void
void
void
void
setScrollContainer(boolean p0)
void
void
setScrollIndicators(int p0, int p1)
void
setScrollX(int p0)
void
setScrollY(int p0)
void
void
setSelected(boolean p0)
void
void
void
void
void
void

This method is deprecated. Deprecated in Java

void
void
setTag(int p0, @NonNull Object p1)
void
setTagInternal(int p0, @NonNull Object p1)
void
void
void
void
void
setTop(int p0)
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void

This method is deprecated. Deprecated in Java

void
setWillNotDraw(boolean p0)
void
setX(float p0)
void
setY(float p0)
void
setZ(float p0)
boolean
boolean
showContextMenu(float p0, float p1)
@NonNull ActionMode
@NonNull ActionMode
void
void
boolean
startDrag(
    @NonNull ClipData p0,
    @NonNull View.DragShadowBuilder p1,
    @NonNull Object p2,
    int p3
)

This method is deprecated. Deprecated in Java

boolean
startDragAndDrop(
    @NonNull ClipData p0,
    @NonNull View.DragShadowBuilder p1,
    @NonNull Object p2,
    int p3
)
boolean
startMovingTask(float p0, float p1)
boolean
void
boolean
boolean
@NonNull String
void
void
void
void
void
@NonNull RenderNode
void
boolean
boolean

This method is deprecated. Deprecated in Java

boolean
@ViewDebug.ExportedProperty(category = "drawing")
willNotDraw()
From android.view.ViewGroup
void
void
void
addFocusables(@NonNull ArrayList<@NonNull View> p0, int p1, int p2)
void
boolean
void
void
addTransientView(@NonNull View p0, int p1)
void
attachLayoutAnimationParameters(
    @NonNull View p0,
    @NonNull ViewGroup.LayoutParams p1,
    int p2,
    int p3
)
void
attachViewToParent(
    @NonNull View p0,
    int p1,
    @NonNull ViewGroup.LayoutParams p2
)
void
@NonNull ArrayList<@NonNull View>
boolean
void
boolean
void
void
void
void
void
void
@NonNull Bitmap
void
debug(int p0)
void
void
void
void
void
detachViewsFromParent(int p0, int p1)
boolean
dispatchActivityResult(
    @NonNull String p0,
    int p1,
    int p2,
    @NonNull Intent p3
)
@NonNull WindowInsets
boolean
void
void
void
boolean
void
void
dispatchDrawableHotspotChanged(float p0, float p1)
void
void
boolean
boolean
void
boolean
boolean
boolean
boolean
void
boolean
void
void
void
void
void
void
void
void
dispatchSetPressed(boolean p0)
void
dispatchSetSelected(boolean p0)
void
void

This method is deprecated. Deprecated in Java

void
boolean
boolean
boolean
void
void
void
void
@NonNull WindowInsets
@NonNull WindowInsetsAnimation.Bounds
void

This method is deprecated. Deprecated in Java

void
boolean
drawChild(@NonNull Canvas p0, @NonNull View p1, long p2)
void
void
void
@NonNull View
void
@NonNull OnBackInvokedDispatcher
@NonNull View
@NonNull View
@NonNull T
<T extends View> findViewByPredicateTraversal(
    @NonNull Predicate<@NonNull View> p0,
    @NonNull View p1
)
@NonNull T
<T extends View> findViewTraversal(int p0)
@NonNull T
void
findViewsWithText(
    @NonNull ArrayList<@NonNull View> p0,
    @NonNull CharSequence p1,
    int p2
)
@NonNull View
focusSearch(@NonNull View p0, int p1)
void
boolean
@NonNull ViewGroup.LayoutParams
@NonNull ViewGroup.LayoutParams
@NonNull ViewGroup.LayoutParams
@NonNull View
getChildAt(int p0)
int
int
int
getChildDrawingOrder(int p0, int p1)
boolean
boolean
boolean
getChildVisibleRect(
    @NonNull View p0,
    @NonNull Rect p1,
    @NonNull Point p2,
    boolean p3
)
boolean
boolean
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()
@NonNull View
@NonNull LayoutAnimationController
@NonNull Animation.AnimationListener
int
@NonNull LayoutTransition
int
@NonNull ViewGroupOverlay
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 method is deprecated. Deprecated in Java

boolean
@NonNull View
int
int
boolean
boolean
boolean
boolean
int
void
internalSetPadding(int p0, int p1, int p2, int p3)
void

This method is deprecated. Deprecated in Java

@NonNull ViewParent

This method is deprecated. Deprecated in Java

boolean

This method is deprecated. Deprecated in Java

boolean

This method is deprecated. Deprecated in Java

boolean
boolean

This method is deprecated. Deprecated in Java

boolean
boolean
boolean
boolean
isTransformedTouchPointInView(
    float p0,
    float p1,
    @NonNull View p2,
    @NonNull PointF p3
)
void
void
layout(int p0, int p1, int p2, int p3)
void
void
void
measureChild(@NonNull View p0, int p1, int p2)
void
measureChildWithMargins(@NonNull View p0, int p1, int p2, int p3, int p4)
void
measureChildren(int p0, int p1)
void
notifySubtreeAccessibilityStateChanged(
    @NonNull View p0,
    @NonNull View p1,
    int p2
)
void
void
void
void
void
onChildVisibilityChanged(@NonNull View p0, int p1, int p2)
@NonNull int[]
void
void
void
void
void
void
boolean
boolean
boolean
onNestedFling(@NonNull View p0, float p1, float p2, boolean p3)
boolean
onNestedPreFling(@NonNull View p0, float p1, float p2)
boolean
onNestedPrePerformAccessibilityAction(
    @NonNull View p0,
    int p1,
    @NonNull Bundle p2
)
void
onNestedPreScroll(@NonNull View p0, int p1, int p2, @NonNull int[] p3)
void
onNestedScroll(@NonNull View p0, int p1, int p2, int p3, int p4)
void
boolean
boolean
boolean
@NonNull PointerIcon
void
boolean
void
void
void
boolean
void
void
void
void
removeDetachedView(@NonNull View p0, boolean p1)
void
void
void
removeViewAt(int p0)
void
void
removeViews(int p0, int p1)
void
removeViewsInLayout(int p0, int p1)
void
boolean
requestChildRectangleOnScreen(
    @NonNull View p0,
    @NonNull Rect p1,
    boolean p2
)
void
boolean
requestFocus(int p0, @NonNull Rect p1)
boolean
void
void
void
void
void
void
void
void
void
boolean
void
void
boolean
boolean
boolean
boolean
boolean
boolean
void
void
void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void

This method is deprecated. Deprecated in Java

void
void

This method is deprecated. Deprecated in Java

void
setClipChildren(boolean p0)
void
setClipToPadding(boolean p0)
void
void
void
void
setLayoutMode(int p0)
void
void
void
void

This method is deprecated. Deprecated in Java

void
void
void
boolean
boolean
showContextMenuForChild(@NonNull View p0, float p1, float p2)
@NonNull ActionMode
@NonNull ActionMode
startActionModeForChild(
    @NonNull View p0,
    @NonNull ActionMode.Callback p1,
    int p2
)
void
void
void
void
suppressLayout(boolean p0)
void
void

Public constructors

ComposeView

public ComposeView(
    @NonNull Context context,
    AttributeSet attrs,
    int defStyleAttr
)

Public methods

Content

@Composable
public void Content()

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.

getAccessibilityClassName

public @NonNull CharSequence getAccessibilityClassName()

setContent

public final void setContent(@Composable @NonNull Function0<Unit> content)

Set the Jetpack Compose UI content for this view. Initial composition will occur when the view becomes attached to a window or when createComposition is called, whichever comes first.

Protected methods

getShouldCreateCompositionOnAttachedToWindow

protected boolean getShouldCreateCompositionOnAttachedToWindow()

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 functions

WindowInsetsKt.getConsumeWindowInsets

public final boolean WindowInsetsKt.getConsumeWindowInsets(@NonNull ComposeView receiver)

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.

WindowInsetsKt.setConsumeWindowInsets

public final void WindowInsetsKt.setConsumeWindowInsets(
    @NonNull ComposeView receiver,
    boolean consumeWindowInsets
)

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.