我有调试Android项目的问题.我可以部署到设备并运行它,一切正常但如果我尝试调试,应用程序部署到设备并且非常简短地打开,启动屏幕显示但应用程序然后关闭.
我在Visual Studio 2015上使用Xamarin Forms.
设备正在运行Android Oreo(8.0.0).运行Android 6.0.1的另一台设备正在调试.
输出显示如下:
InspectorDebugSession(11): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(11): Constructed
Android application is debugging.
InspectorDebugSession(11): HandleTargetEvent: TargetExited
InspectorDebugSession(11): Disposed
Couldn't connect to logcat, GetProcessId returned: 0
Run Code Online (Sandbox Code Playgroud)
我检查了Logcat,它似乎遇到了查找FFImageLoading库的问题:
Time Device Name Type PID Tag Message
09-18 14:35:52.361 Huawei Nexus 6P Debug 1560 Mono AOT:
image '/usr/local/lib/mono/aot-cache/arm/FFImageLoading.Platform.dll.so'
not found: dlopen failed: library "/data/app/myapp.android.dev-
WEb1bz8edgF7vwx6uCoZ-A==/lib/arm/libaot-FFImageLoading.Platform.dll.so" not found
Run Code Online (Sandbox Code Playgroud)
我已经为我的项目添加了用于FFImageLoading的Nuget包,Droid项目引用如下图所示:
xamarin.android xamarin.forms android-6.0-marshmallow ffimageloading android-8.0-oreo
尝试初始化FFImage时(在我的应用程序中):
CachedImageRenderer.Init();
Run Code Online (Sandbox Code Playgroud)
我得到了一个神秘的错误:
Unhandled Exception: System.TypeLoadException: Could not load list of method overrides occurred
Run Code Online (Sandbox Code Playgroud)
我可以让FFImage示例应用程序运行正常.据我所知,我依赖所有依赖项.
在 Xamarin.Android 中,若要使用 FFImageLoading 加载图像,必须使用 ImageViewAsync 而不是标准 ImageView。
如果我想将图像加载到 ImageButton 中,我找不到可以使用的内容。没有找到“ImageButtonAsync”。
我目前正在使用 FFImageLoading 包进行缓存等以在用户界面上显示。我不确定 FFImageLoading 是否具有调整图像本身大小的功能,以便我可以保存它并通过互联网发送。
我正在使用FFImageLoading而不是Image在我的项目中使用占位符等更高级的功能。在我的项目中,有一个需要显示的图像列表。所以我使用了一个列表视图。
<ListView x:Name="membersList" ItemTapped="Handle_ItemTappedMember" HorizontalOptions="FillAndExpand" HasUnevenRows="true" SeparatorVisibility="None" BackgroundColor="#EEEEEE" Grid.Row="0" Grid.Column="0">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="5,5,5,5" HeightRequest="75" Margin="10,5,10,5" BackgroundColor="White" HorizontalOptions="FillAndExpand">
<ffimageloading:CachedImage Source="{Binding imageUrl}" x:Name="patImage" WidthRequest="60" HeightRequest="60" Aspect="AspectFill" VerticalOptions="Center">
<ffimageloading:CachedImage.Transformations>
<fftransformations:CircleTransformation />
</ffimageloading:CachedImage.Transformations>
</ffimageloading:CachedImage>
<StackLayout Spacing="3" Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="FillAndExpand">
<Label FontAttributes="Bold" FontSize="14" TextColor="#212121" Text="{Binding FullName}" />
<Label FontSize="12" TextColor="#212121" Text="{Binding Relation}" />
<Label FontSize="12" TextColor="#212121" Text="{Binding Pat_ID}" />
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Run Code Online (Sandbox Code Playgroud)
我的问题是我不想在这里使用缓存技术,因为我的服务器图像可能会在不更改 URL 的情况下更改。
我知道如何使用 FFImageLoading 清除单个图像视图的缓存
await CachedImage.InvalidateCache(Image.Source, CacheType.All, true);
Run Code Online (Sandbox Code Playgroud)
但是如何在 …
Xamarin.FFImageLoading SVG 似乎不适用于 Android 11 和 12。
例如,当我将 Android Target 设置为 11 版本时,在嵌入式资源上设置 SVG,使用以下代码:
<ffimageloadingsvg:SvgCachedImage HeightRequest="12" Source="resource://DemoApp.Assets.Images.svgImage.svg" BackgroundColor="Transparent" Aspect="Fill" HorizontalOptions="FillAndExpand" VerticalOptions="Start"/>
Run Code Online (Sandbox Code Playgroud)
除了 Android 11 和 12 之外,此 SVG 工作正常。
谁能帮忙找出为什么它在 Android 11 和 12 上不显示吗?
下面的代码使用ffimageloading组件呈现高度为200 像素的图像。我需要点击这个图像并全屏显示图像或缩放它。ffimageloading 是否可行,或者我需要通过每个平台(android 和 ios)实现它?
看法
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
x:Class="Namespace.Views.MyClass">
<Grid Padding="0"
Margin="0"
BackgroundColor="{StaticResource BackgroundColor}">
<Grid.RowDefinitions>
<RowDefinition Height="200" />
</Grid.RowDefinitions>
<ffimageloading:CachedImage
Grid.Row="0"
Source="{Binding ThumbPath}"
Aspect="AspectFill">
<ffimageloading:CachedImage.LoadingPlaceholder>
<OnPlatform
x:TypeArguments="ImageSource"
iOS="logo_header"
Android="logo_header" />
</ffimageloading:CachedImage.LoadingPlaceholder>
<ffimageloading:CachedImage.ErrorPlaceholder>
<OnPlatform
x:TypeArguments="ImageSource"
iOS="noimage"
Android="noimage" />
</ffimageloading:CachedImage.ErrorPlaceholder>
</ffimageloading:CachedImage>
</Grid>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
ViewModel(使用棱镜)
public class MyClassViewModel : BindableBase, INavigationAware
{
public MyClassViewModel()
{
}
private string _thumbPath;
public PerfilPetDto ThumbPath
{
get
{
return "https://www.google.com.br/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png";
}
set …Run Code Online (Sandbox Code Playgroud)