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

InlineContentView

public class InlineContentView
extends ViewGroup

java.lang.Object
   ↳ 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 inined 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 you attach and detach this view it can not longer be reused and you should obtain a new view from the platform via the dedicated APIs.

Summary

Nested classes

interface InlineContentView.SurfaceControlCallback

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

Inherited XML attributes

Inherited constants

Inherited fields

Public methods

SurfaceControl getSurfaceControl()

Gets the surface control.

boolean isZOrderedOnTop()
void onLayout(boolean changed, int l, int t, int r, int b)

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

void setSurfaceControlCallback(InlineContentView.SurfaceControlCallback callback)

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

boolean setZOrderedOnTop(boolean onTop)

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

Inherited methods

Public methods

getSurfaceControl

Added in API level 30
public SurfaceControl getSurfaceControl ()

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

Returns
SurfaceControl The surface control.

isZOrderedOnTop

Added in API level 30
public boolean isZOrderedOnTop ()

Returns
boolean Whether the surface backing this view appears on top of its parent.

onLayout

Added in API level 30
public void onLayout (boolean changed, 
                int l, 
                int t, 
                int r, 
                int b)

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

l int: Left position, relative to parent

t int: Top position, relative to parent

r int: Right position, relative to parent

b int: Bottom position, relative to parent

setSurfaceControlCallback

Added in API level 30
public void setSurfaceControlCallback (InlineContentView.SurfaceControlCallback callback)

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. This value may be null.

setZOrderedOnTop

Added in API level 30
public boolean setZOrderedOnTop (boolean onTop)

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.

Returns
boolean

See also: