Android APIs
public class

ViewStubProxy

extends Object
java.lang.Object
   ↳ android.databinding.ViewStubProxy

Class Overview

This class represents a ViewStub before and after inflation. Before inflation, the ViewStub is accessible. After inflation, the root View of the inflated layout will be available. If the inflated layout has data binding, the ViewDataBinding for the inflated View is accessible.

Summary

Public Constructors
ViewStubProxy(ViewStub viewStub)
Public Methods
ViewDataBinding getBinding()
Returns the data binding associated with the inflated layout once it has been inflated.
View getRoot()
Returns the root View of the layout replacing the ViewStub once it has been inflated.
ViewStub getViewStub()
Returns the ViewStub in the layout or null if the ViewStub has been inflated.
boolean isInflated()
Returns true if the ViewStub has replaced itself with the inflated layout or false if not.
void setContainingBinding(ViewDataBinding containingBinding)
void setOnInflateListener(ViewStub.OnInflateListener listener)
Sets the ViewStub.OnInflateListener to be called when the ViewStub inflates.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ViewStubProxy (ViewStub viewStub)

Public Methods

public ViewDataBinding getBinding ()

Returns the data binding associated with the inflated layout once it has been inflated. null prior to inflation or if there is no binding associated with the layout.

Returns
  • the data binding associated with the inflated layout once it has been inflated. null prior to inflation or if there is no binding associated with the layout

public View getRoot ()

Returns the root View of the layout replacing the ViewStub once it has been inflated. null is returned prior to inflation.

Returns
  • the root View of the layout replacing the ViewStub once it has been inflated. null is returned prior to inflation

public ViewStub getViewStub ()

Returns the ViewStub in the layout or null if the ViewStub has been inflated.

Returns
  • the ViewStub in the layout or null if the ViewStub has been inflated.

public boolean isInflated ()

Returns true if the ViewStub has replaced itself with the inflated layout or false if not.

Returns
  • true if the ViewStub has replaced itself with the inflated layout or false if not

public void setContainingBinding (ViewDataBinding containingBinding)

public void setOnInflateListener (ViewStub.OnInflateListener listener)

Sets the ViewStub.OnInflateListener to be called when the ViewStub inflates. The proxy must have an OnInflateListener, so listener will be called immediately after the proxy's listener is called.

Parameters
listener The OnInflateListener to notify of successful inflation