Added in API level 30

InlineContentView


open class InlineContentView : ViewGroup
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ android.widget.inline.InlineContentView

This class represents a view that holds opaque content from another app that you can inline in your UI.

Since the content presented by this view is from another security domain,it is shown on a remote surface preventing the host application from accessing that content. Also the host application cannot interact with the inlined content by injecting touch events or clicking programmatically.

This view can be overlaid by other windows, i.e. redressed, but if this is the case the inlined UI would not be interactive. Sometimes this is desirable, e.g. animating transitions.

By default the surface backing this view is shown on top of the hosting window such that the inlined content is interactive. However, you can temporarily move the surface under the hosting window which could be useful in some cases, e.g. animating transitions. At this point the inlined content will not be interactive and the touch events would be delivered to your app.

Instances of this class are created by the platform and can be programmatically attached to your UI. Once the view is attached to the window, you may detach and reattach it to the window. It should work seamlessly from the hosting process's point of view.

Summary

Nested classes
abstract

Callback for observing the lifecycle of the surface control that manipulates the backing secure embedded UI surface.

Inherited XML attributes
Inherited constants
Public methods
open SurfaceControl?

Gets the surface control.

open Boolean

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

Called from layout when this view should assign a size and position to each of its children.

open Unit
setClipBounds(clipBounds: Rect!)

Sets a rectangular area on this view to which the view will be clipped when it is drawn.

open Unit

Sets a callback to observe the lifecycle of the surface control for managing the backing surface.

open Boolean

Controls whether the backing surface is placed on top of this view's window.

Protected methods
open Unit

This is called when the view is attached to a window.

open Unit

This is called when the view is detached from a window.

Inherited functions
Inherited properties

Public methods

getSurfaceControl

Added in API level 30
open fun getSurfaceControl(): SurfaceControl?

Gets the surface control. If the surface is not created this method returns null.

Return
SurfaceControl? The surface control.

isZOrderedOnTop

Added in API level 30
open fun isZOrderedOnTop(): Boolean
Return
Boolean Whether the surface backing this view appears on top of its parent.

onLayout

Added in API level 30
open fun onLayout(
    changed: Boolean,
    l: Int,
    t: Int,
    r: Int,
    b: Int
): Unit

Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.

Parameters
changed Boolean: This is a new size or position for this view
left Left position, relative to parent
top Top position, relative to parent
right Right position, relative to parent
bottom Bottom position, relative to parent

setClipBounds

Added in API level 30
open fun setClipBounds(clipBounds: Rect!): Unit

Sets a rectangular area on this view to which the view will be clipped when it is drawn. Setting the value to null will remove the clip bounds and the view will draw normally, using its full bounds.

Parameters
clipBounds Rect!: The rectangular area, in the local coordinates of this view, to which future drawing operations will be clipped.

setSurfaceControlCallback

Added in API level 30
open fun setSurfaceControlCallback(callback: InlineContentView.SurfaceControlCallback?): Unit

Sets a callback to observe the lifecycle of the surface control for managing the backing surface.

Parameters
callback InlineContentView.SurfaceControlCallback?: The callback to set or null to clear.

setZOrderedOnTop

Added in API level 30
open fun setZOrderedOnTop(onTop: Boolean): Boolean

Controls whether the backing surface is placed on top of this view's window. Normally, it is placed on top of the window, to allow interaction with the inlined UI. Via this method, you can place the surface below the window. This means that all of the contents of the window this view is in will be visible on top of its surface.

The Z ordering can be changed dynamically if the backing surface is created, otherwise the ordering would be applied at surface construction time.

Parameters
onTop Boolean: Whether to show the surface on top of this view's window.

Protected methods

onAttachedToWindow

Added in API level 30
protected open fun onAttachedToWindow(): Unit

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int,int).
If you override this method you must call through to the superclass implementation.

onDetachedFromWindow

Added in API level 30
protected open fun onDetachedFromWindow(): Unit

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.
If you override this method you must call through to the superclass implementation.