I have Xamarin Forms application. I need to put image as json in project.
Here is XAML:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:forms="clr-namespace:Lottie.Forms;assembly=Lottie.Forms"
x:Class="xxx.Views.ScanReadyPage">
<StackLayout>
<forms:AnimationView
x:Name="lottie"
Animation="12240-cash-car.json"
Loop="False"
AutoPlay="True"
WidthRequest="200"
HeightRequest="200"
Margin="10,0,10,0"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
I have installed Com.Airbnb.Xamarin.Forms.Lottie version 3.0.3 and Xamarin.Forms version 4.3.0.991221
I have added downloaded file from lottiefiles.com: 12240-cash-car.json to Assets folder in XamarinForms.Android project and set build action to Android Asset.
Nothing is displayed on Android. No informations at output, no error occured. I have changed Xamarin Forms to 3.6.0 - no changes. I have installed all versions of Lottie: from 2.6.3 to 3.0.3. - no image is being displayed. (Version 2.6.3. and earlier have error about missing keystore).
I have checked code behind version but it is also not working:
public MainPage()
{
element = new AnimationView()
{
Loop = true,
AutoPlay = true,
Animation = "12230-bounce-down-steps.json",
WidthRequest = 400,
HeightRequest = 400,
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
IsVisible = true,
Speed = 1
};
}
AnimationView element = new AnimationView();
protected override void OnAppearing()
{
element.Animation = "12230-bounce-down-steps.json";
element.Play();
}
How to make it works?