带有最新 MVVMCross 的 ActionBarSherlock [英] ActionBarSherlock with latest MVVMCross
问题描述
有人知道如何在最新的 MVMCross 中使用 ActionBarSherlock 的示例吗?
Does anyone have a sample how to use ActionBarSherlock with latest MVVMCross?
有 Roosmaa/MvvmCross.ActionBarSherlock,但它不适用于最新的 MVMCross,我不确定它是否已准备好用于生产.
There's Roosmaa / MvvmCross.ActionBarSherlock but it doesn't work with latest MVVMCross and I am not sure how ready it is for production use.
还有 LegacyBar,但我也找不到 MVVMCross 的示例.
There's also LegacyBar but also I couldn't find a sample with MVVMCross.
推荐答案
我相信 LegacyBar 已与 MvvmCross 一起使用 - 所以这肯定是您的一个选择.
I believe LegacyBar has been used with MvvmCross - so that certainly could be an option for you.
或者,另一个可用选项是为 Sherlock 中的活动和/或片段添加数据绑定支持.
Alternatively, another available option is to add data-binding support to the activities and/or fragments in Sherlock.
对于活动,MvvmCross 使用添加的几个小层代码将活动调整为数据绑定:
For activities, MvvmCross adapts activities into data-binding using a couple of small layers of code to add:
- 生命周期事件
- 数据绑定上下文
此代码在MVVMCross for android - 如何在代码中做绑定?
如果您按照该问题中附加"部分的两个步骤进行操作,那么您应该能够创建一个 MvxSherlockActivity
If you follow the two steps from the 'Additionally' section in that question, then that should enable you to create an MvxSherlockActivity
对于片段,这里没有关于 SO 的详细现有答案,但该过程与以下两个步骤基本相同:
For fragments, there's no detailed existing answer here on SO, but the process is basically the same two steps with:
- 一个事件层,如 - https://github.com/slodge/MvvmCross/blob/v3/Crillous/Cirrious.MvvmCross.Droid.Fragging/Fragments/EventSource/MvxEventSourceFragment.cs
- 数据绑定层,例如 - https://github.com/slodge/MvvmCross/blob/v3/Crillous/Cirrious.MvvmCross.Droid.Fragging/Fragments/MvxFragment.cs
同样的代码应该允许某人从任何 FooFragment
This same code should allow someone to create an MvxFooFragment
from any FooFragment
这篇关于带有最新 MVVMCross 的 ActionBarSherlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!