locked
SVG image is not displaying in android in xamarin.forms RRS feed

  • Question

  • User337144 posted

    I am trying ti display the SVG image in my xamarin.form application, there are no issues to display the SVG image in iOS but not able to display the same image in the android application.

    here is my code to display the svg image <ContentView.Resources> <ResourceDictionary> <ffimageloadingsvg:SvgImageSourceConverter x:Key="SvgImageSourceConverter"></ffimageloadingsvg:SvgImageSourceConverter> </ResourceDictionary> </ContentView.Resources> <ContentView.Content> <ffimageloadingsvg:SvgCachedImage Source="{Binding SvgFileName, Converter={StaticResource SvgImageSourceConverter}}" Grid.Column="0" WidthRequest="200" HeightRequest="600" ReplaceStringMap="{Binding BodyMapreplceStrings}" /> </ContentView.Content>

    And from View Model I am binding the image as following

     public string SvgFileName
            {
                get { return _svgFileName; }
                set
                {
                    _svgFileName = value;
                    OnPropertyChanged();
                }
            }
    

    and

    SvgFileName="Flower.svg";

    and given svg image in Resources for iOS and in Resources ->drawable

    in MainActivity added following lines CachedImageRenderer.Init(true); var ignore = typeof(SvgCachedImage);

    Is there anything I am missing?

    Friday, December 28, 2018 1:07 PM

All replies

  • User380187 posted

    Hi @"Praveen.B" , which way used to show SVG image. Do you refer to this link?

    Monday, December 31, 2018 5:39 AM
  • User337144 posted

    Thanks for the reference @JuniorJiang , I am using FFimageLoading for loading SVG images.

    Monday, December 31, 2018 5:44 AM
  • User389838 posted

    I had the similar issue and the cause was i had two files with same name but with different extension like 'demo.png' and 'demo.svg'; i don't know if u have similar cause but renaming the file solved my issue.

    Wednesday, November 27, 2019 8:50 AM