我尝试将MVXActivity转换为MvxFragment,当我尝试给布局充气时,应用程序崩溃在MvxAdapter创建过程中bindingContext为null - 只应在特定绑定上下文放在堆栈上时创建适配器
<span class="text-center m-sm">
<span class="fa fa-circle fa-1x"></span>
<span class="font-bold no-margins">
testdevice 1
</span>
</span>
<span class="text-center m-sm">
<span class="fa fa-circle fa-1x"></span>
<span class="font-bold no-margins">
testdevice 2
</span>
</span>
<span class="text-center m-sm">
<span class="fa fa-circle fa-1x"></span>
<span class="font-bold no-margins">
testdevice 3
</span>
</span>
我的布局如下所示
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
return inflater.Inflate(Resource.Layout.BrandView1, container, false);
}
答案 0 :(得分:1)
我发现我需要使用BindingInflate。
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
this.EnsureBindingContextIsSet(inflater);
return this.BindingInflate(Resource.Layout.BrandView1, container, false);
}