Stay organized with collections Save and categorize content based on your preferences.

ViewStubProxy

public class ViewStubProxy
extends Object

↳ android.databinding.ViewStubProxy


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.

Inherited methods

From class java.lang.Object
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait(long arg0, int arg1)
final void wait(long arg0)
final void wait()

Public constructors

ViewStubProxy

ViewStubProxy (ViewStub viewStub)

Parameters
viewStub ViewStub

Public methods

getBinding

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
ViewDataBinding 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

getRoot

View getRoot ()

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

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

getViewStub

ViewStub getViewStub ()

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

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

isInflated

boolean isInflated ()

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

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

setContainingBinding

void setContainingBinding (ViewDataBinding containingBinding)

Parameters
containingBinding ViewDataBinding

setOnInflateListener

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 ViewStub.OnInflateListener: The OnInflateListener to notify of successful inflation

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025年02月10日 UTC.