跳转到相应内容

最常访问

最近访问

navigation

ViewStubProxy

public class ViewStubProxy
extends Object

java.lang.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

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

此网站会使用 Cookie 来存储您在此网站上指定的语言和显示选项偏好设置。

获取最新的 Android Developers 资讯和提示,助您在 Google Play 上取得成功。

* 必填字段

成功!

在微信上关注 Google Developers

要以浏览此网站吗?

您请求访问的是网页,但是您为此网站设置的语言偏好为

要更改您的语言偏好设置并以浏览此网站吗?如果以后您想要更改语言偏好设置,请使用每个页面底部的语言菜单。

该类需要 或更高的 API 级别

此文档已被隐藏,因为您为该文档选择的 API 级别是 。您可以使用左侧导航栏上方的选择器来更改文档的 API 级别。

要详细了解如何根据您的应用需求指定 API 级别,请参阅支持不同平台版本

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)