Gif Xamarin 表单 Android
Gif Xamarin forms Android
我知道xamarin forms目前支持播放gif。
我已经尝试过 link https://github.com/jfversluis/AnimatedGifForms/
但它似乎只适用于示例中类型的 gif,我已经尝试了另一个 gif,但它无法在 android 上加载。
它在 IOS 上完美运行。
我可以做任何配置来以 xamarin 形式播放 gif
我正在使用 Xamarin.form 4.6,最新的 Xamarin.Essential 1.5.3
您可以使用Image控件在Xamarin.forms中加载gif。
<StackLayout>
<!-- Place new controls here -->
<Image Source="sample.gif" IsAnimationPlaying="True"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
Starting and stopping is controlled through IsAnimationPlaying.
Originally we were going to use Start and Stop methods but all these
did was set IsAnimationPlaying to true or false respectively. This way
it can also be started and stopped via Binding!!
我上传了一个示例项目here,你可以查看。
更新:
使用Xamarin.FFImageLoading.Svg.Forms加载:
xmlns:ffimageloading="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"
<StackLayout>
<ffimageloading:SvgCachedImage HorizontalOptions="Center" VerticalOptions="CenterAndExpand" Source="blue.gif" />
</StackLayout>
别忘了 CachedImageRenderer.Init(true);
在 MainActivity
:
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
//Forms.SetFlags("UseLegacyRenderers");
CachedImageRenderer.Init(true);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
我知道xamarin forms目前支持播放gif。 我已经尝试过 link https://github.com/jfversluis/AnimatedGifForms/ 但它似乎只适用于示例中类型的 gif,我已经尝试了另一个 gif,但它无法在 android 上加载。 它在 IOS 上完美运行。 我可以做任何配置来以 xamarin 形式播放 gif 我正在使用 Xamarin.form 4.6,最新的 Xamarin.Essential 1.5.3
您可以使用Image控件在Xamarin.forms中加载gif。
<StackLayout>
<!-- Place new controls here -->
<Image Source="sample.gif" IsAnimationPlaying="True"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
Starting and stopping is controlled through IsAnimationPlaying. Originally we were going to use Start and Stop methods but all these did was set IsAnimationPlaying to true or false respectively. This way it can also be started and stopped via Binding!!
我上传了一个示例项目here,你可以查看。
更新:
使用Xamarin.FFImageLoading.Svg.Forms加载:
xmlns:ffimageloading="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"
<StackLayout>
<ffimageloading:SvgCachedImage HorizontalOptions="Center" VerticalOptions="CenterAndExpand" Source="blue.gif" />
</StackLayout>
别忘了 CachedImageRenderer.Init(true);
在 MainActivity
:
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
//Forms.SetFlags("UseLegacyRenderers");
CachedImageRenderer.Init(true);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}