微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

MvxRecyclerView adaper OnBindViewHolder'不支持指定的方法'错误

如何解决MvxRecyclerView adaper OnBindViewHolder'不支持指定的方法'错误

我尝试在MvxCachedImageView中将高度设置为OnBindViewHolder,以便在滚动时设置图像位置大小
滚动时,我在适配器中收到System.NotSupportedException: Specified method is not supported错误

public override void OnBindViewHolder(RecyclerView.ViewHolder holder,int position)
        {
            base.OnBindViewHolder(holder,position); // error here

            ItemVM item = _viewmodel.Items.ElementAt(position);

            MvxCachedImageView itemImage = holder.ItemView.FindViewById<MvxCachedImageView>(Resource.Id.content);
            if (itemImage != null)
            {
                int intHeight = (int)(_screenWidth / item.AspectRatio);
                itemImage.SetMinimumHeight(intHeight);
                itemImage.SetMaxHeight(intHeight);
            }
        }

适配器构造器:

public MyAdapter(IMvxAndroidBindingContext bindingContext,ItemsVM viewmodel,MvxAppCompatActivity context) : base(bindingContext)
        {
            _viewmodel = viewmodel;
            _context = context;

            displayMetrics displayMetrics = new displayMetrics();
            _context.WindowManager.Defaultdisplay.GetMetrics(displayMetrics);
            _screenWidth = displayMetrics.WidthPixels;
        }

错误堆栈跟踪:

  at Android.Runtime.InputStreamInvoker.get_Length () [0x00014] in <9a14097a65a445eaa85f6a3a1ade52a3>:0 
  at FFImageLoading.StreamExtensions.AsSeekableStreamAsync (System.IO.Stream stream,System.Boolean forcecopy) [0x0001b] in C:\projects\ffimageloading\source\FFImageLoading.Common\Extensions\StreamExtensions.cs:18 }

任何想法都会帮助我!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。