public class ViewStubProxy
extends Object
java.lang.Object | |
↳ | android.databinding.ViewStubProxy |
此类表示通货膨胀前后的ViewStub。 在通货膨胀之前,可以访问ViewStub。 通货膨胀后,充气布局的根视图将可用。 如果充气布局具有数据绑定,则可以访问充气视图的ViewDataBinding。
Public constructors |
|
---|---|
ViewStubProxy(ViewStub viewStub) |
Public methods |
|
---|---|
ViewDataBinding |
getBinding() 一旦膨胀,返回与充气布局相关的数据绑定。 |
View |
getRoot() 一旦已经充气,返回替换ViewStub的布局的根视图。 |
ViewStub |
getViewStub() 如果ViewStub已被夸大,则返回布局中的ViewStub或 |
boolean |
isInflated() 返回 |
void |
setContainingBinding(ViewDataBinding containingBinding) |
void |
setOnInflateListener(ViewStub.OnInflateListener listener) 设置 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
ViewDataBinding getBinding ()
一旦膨胀,返回与充气布局相关的数据绑定。 null
在通货膨胀之前或者如果没有与布局相关联的绑定。
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 |
View getRoot ()
一旦已经充气,返回替换ViewStub的布局的根视图。 在通货膨胀前返回null
。
Returns | |
---|---|
View |
the root View of the layout replacing the ViewStub once it has been inflated. null is returned prior to inflation |
ViewStub getViewStub ()
如果ViewStub已膨胀,则返回布局中的ViewStub或 null
。
Returns | |
---|---|
ViewStub |
the ViewStub in the layout or null if the ViewStub has been inflated. |
boolean isInflated ()
返回 true
如果ViewStub已经取代自身与膨胀的布局或 false
如果不是。
Returns | |
---|---|
boolean |
true if the ViewStub has replaced itself with the inflated layout or false if not |
void setContainingBinding (ViewDataBinding containingBinding)
Parameters | |
---|---|
containingBinding |
ViewDataBinding
|
void setOnInflateListener (ViewStub.OnInflateListener listener)
设置ViewStub.OnInflateListener
当ViewStub充气时被调用。 该代理必须具有OnInflateListener,因此将在调用代理的侦听器后立即调用listener
。
Parameters | |
---|---|
listener |
ViewStub.OnInflateListener : The OnInflateListener to notify of successful inflation |