
<Mvx.MvxListVIEw androID:layout_margintop="10px" androID:textFilterEnabled="true" androID:choiceMode="singleChoice" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:textSize="20dp" local:MvxBind="ItemsSource Data; ItemClick LaunchCapabilityVIEwCmd" local:MvxItemTemplate="@layout/itemtemplate1" />
而不是将MvxItemTemplate硬编码为itemtemplate1,可以根据我想在此视图中显示的数据类型动态设置它吗?我正在寻找与WPF的DateTemplateSelector类似的功能.
TIA.
解决方法 您必须使用自定义适配器才能执行此 *** 作.一些样本显示了如何使用细胞类型选择.看到:
> https://github.com/slodge/MvvmCross-Tutorials/tree/master/Working%20With%20Collections中的多态列表
> https://github.com/slodge/MvvmCross-Tutorials/tree/master/Sample%20-%20CirriousConference中会话列表视图中的分组列表
例如从PolymorphicListItemTypesView.cs
protected overrIDe VIEw GetBindableVIEw(VIEw convertVIEw,object source,int templateID) { if (source is Kitten) templateID = Resource.Layout.ListItem_Kitten; else if (source is Dog) templateID = Resource.Layout.ListItem_Dog; return base.GetBindableVIEw(convertVIEw,source,templateID); } 对于AndroID,还有一个优化应该添加到现有的多态适配器示例 – 包括使用GetItemVIEwType以更好地重用convertVIEw – 请参阅https://github.com/slodge/MvvmCross/issues/333
这个问题与以下内容有关:
> Several item templates in one listbox in mvvmcross Android
> getViewTypeCount and getItemViewType methods of ArrayAdapter
以上是内存溢出为你收集整理的android-layout – MvvmCross:MvxListView的动态项模板选择全部内容,希望文章能够帮你解决android-layout – MvvmCross:MvxListView的动态项模板选择所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)