Tag: ffimageloading

Android FFImageLoading使用URI(Xamarin)

我试图从光标加载联系人图像,所以我有每个图像的URI。 但是我想使用FFImageLoading库将这些图像添加到视图中,这样我就可以轻松加载占位符并进行圆形变换。 但是,我在使用带有URI的库时遇到了困难 – 我尝试使用Path将URI转换为url以使用LoadFromURL方法,但这种做法并不成功。 所以我想知道使用LoadImage或LoadStream方法是否更好,但我不确定如何最好地这样做。 这是我本来想要做的 // use FFImageLoading library to asynchronously: await ImageService .Instance .LoadUrl(item.PhotoURL, TimeSpan.FromHours(Settings.ImageCacheDurationHours)) // get the image from a URL .LoadingPlaceholder(“placeholderProfileImage.png”) // specify a placeholder image .Transform(new CircleTransformation()) // transform the image to a circle .Error(e => System.Diagnostics.Debug.WriteLine(e.Message)) .IntoAsync(viewHolder.ProfilePhotoImageView); 但是,对于我从联系人获得的图像,我有一个Uri,我可以使用以下内容加载它,但我无法对其进行转换: var contactUri = ContentUris.WithAppendedId(ContactsContract.Contacts.ContentUri, Contacts[position].LongId); var contactPhotoUri = Android.Net.Uri.WithAppendedPath(contactUri, Android.Provider.Contacts.Photos.ContentDirectory); […]