我正在尝试在跨平台 xamarin 应用程序中使用 FFImageLoading。
我按照说明在 android 和 IOS 项目中安装了 Xamarin.FFImageLoading 和 Xamarin.FFImageLoading.Forms。
然后我使用此代码来初始化库:
[Activity (Label = "app", Icon = "@drawable/icon", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate (Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate (bundle);
CachedImageRenderer.Init();
global::Xamarin.Forms.Forms.Init (this, bundle);
global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle);
LoadApplication (new TheWillowEffect.App ());
}
}
我还没有尝试过它的IOS。不是优先事项。
我有以下 XAML 只是为了看看它是否有效:
<ContentPage
....xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"....>
....
<ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center"
WidthRequest="300" HeightRequest="300"
DownsampleToViewSize="true"
Source = "http://loremflickr.com/600/600/nature?filename=simple.jpg"
Grid.Column="1"
Grid.Row="1">
当我运行它时,我得到:
System.MissingMethodException: method 'FFImageLoading.Forms.Droid.CachedImageRenderer.init()' not found.
不知道发生了什么。我怀疑智能感知会发现一个缺失的using
,并且在编译过程中没有错误,只有上面的错误,在运行时。
我做错了什么!?