【发布时间】:2016-04-08 23:47:20
【问题描述】:
我最近发现了一个名为ViewStub 的类,可用于“延迟加载”布局资源。用法非常简单:
在我使用的布局文件中:
<ViewStub
android:id="@+id/content_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
在我的代码中:
var stub = this.FindViewById<ViewStub>(Resource.Id.content_stub);
stub.LayoutResource = Resource.Layout.FirstView;
stub.Inflate();
但是,这种方式绑定不起作用!我知道,使用 mvvmcross 我必须调用 BindingInflate,但该方法不适用于 ViewStub 我寻找类似 @987654326@ 的东西,但我找不到任何东西。
那么,有没有办法让 ViewStub 的绑定工作?感谢您的帮助。
【问题讨论】: