无法在 ImageView 异步中加载图像

Can't load image in ImageViewAsync

我无法将图像加载到 ImageViewAsync 中。图像应该在的地方只有一个空白。我已经尝试过同步和异步方法。 我在 mipmap 文件夹中有图像 placeholderProfileImage.png。我通过绑定代码引导调试器,一切似乎都井井有条。请注意,我删除了用文本填充视图的其他代码。那部分正在工作。我在图像方面做错了什么?

profilePhotoImageView 在布局中定义:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/acquaintanceRow"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:gravity="center">
    <FFImageLoading.Views.ImageViewAsync
        android:id="@+id/profilePhotoImageView"
        android:scaleType="fitCenter"
        android:layout_width="50dp"
        android:layout_height="100dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:transitionName="@string/profilePhotoTransition" />
>

视图持有者 class 包含 ProfilePhotoImageView:

internal class MyViewHolder : RecyclerView.ViewHolder
    {
    // removed stuff for brevity

        public ImageViewAsync ProfilePhotoImageView { get; }

        public MyViewHolder(View itemView) : base(itemView)
        {
            MyRow = itemView;

    // removed stuff for brevity

            ProfilePhotoImageView = MyRow.FindViewById<ImageViewAsync>(Resource.Id.profilePhotoImageView);
        }
    }

绑定码:

public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
var viewHolder = holder as MyViewHolder;

string photoUrl = "placeholderProfileImage.png:";

FFImageLoading.Work.TaskParameter taskParameter = ImageService.LoadFileFromApplicationBundle(photoUrl);
FFImageLoading.Work.TaskParameter taskParameter2 = taskParameter.Transform(new CircleTransformation());
taskParameter2.Into(viewHolder.ProfilePhotoImageView);

// tried asynchronous as well, nothing
//FFImageLoading.Work.TaskParameter taskParameter = ImageService.LoadUrl(photoUrl);
//FFImageLoading.Work.TaskParameter taskParameter2 = taskParameter.Transform(new CircleTransformation());
//taskParameter2.Into(viewHolder.ProfilePhotoImageView);

}

LoadFileFromApplicationBundle 正在从 Assets 而非 mipmap 文件夹加载文件。因此,您必须将文件移动到 Assets 文件夹并将构建操作设置为 AndroidAsset.