0

I'm trying to load an svg that is in my resource (set as Embeddded Resource VS2019) using the following axml:

<ffimageloading.cross.MvxCachedImageView
    android:layout_width="36dp"
    android:layout_height="36dp"
    local:MvxBind="ImagePath res:svg.passenger" />

but nothing is showing. It takes the 36x36 space but it can not load the svg

in the debug output it shows:

2019-09-12 13:38:13 [ERROR] (MvxBind) Exception thrown during the view binding MvxException: Unexpected character : at position 3 in targetProperty text res:svg.passenger at MvvmCross.Binding.Parse.PropertyPath.MvxPropertyPathParser.ParseNextToken () [0x00036] in C:\projects\mvvmcross\MvvmCross\Binding\Parse\PropertyPath\MvxPropertyPathParser.cs:70 at MvvmCross.Binding.Parse.PropertyPath.MvxPropertyPathParser.Parse (System.String textToParse) [0x00009] in C:\projects\mvvmcross\MvvmCross\Binding\Parse\PropertyPath\MvxPropertyPathParser.cs:39 09-12 13:38:13.606 I/mono-stdout(18939): 2019-09-12 13:38:13 [ERROR] (MvxBind) Exception thrown during the view binding MvxException: Unexpected character : at position 3 in targetProperty text res:svg.passenger

I've also tried:

<ffimageloading.cross.MvxCachedImageView
    android:layout_width="36dp"
    android:layout_height="36dp"
    local:MvxBind="ImagePath res://svg.passenger" />

<ffimageloading.cross.MvxCachedImageView
    android:layout_width="36dp"
    android:layout_height="36dp"
    ImagePath="res:svg.passenger" />

and

<ffimageloading.cross.MvxCachedImageView
    android:layout_width="36dp"
    android:layout_height="36dp"
    ImagePath="res://svg.passenger" />

I'm pretty sure the svg isn't corrupted because if i use XamSvg it shows up alright

<XamSvg.SvgImageView
    local:svg="res:svg.passenger"
    local:colorMapping="4C7BC1=AAAAAA"
    android:layout_width="36dp"
    android:layout_height="36dp" />

update:

<ffimageloading.cross.MvxCachedImageView
       android:gravity="right"
       android:layout_width="36dp"
       android:layout_height="36dp"
       local:MvxBind="ImagePath 'res:passenger.svg'" />

now causes a different exception:

09-12 14:42:56.806 D/skia (23916): --- Failed to create image decoder with message 'unimplemented' Image loading failed: passenger.svg System.BadImageFormatException: Not a valid bitmap at FFImageLoading.PlatformImageLoaderTask1[TImageView].GenerateImageFromDecoderContainerAsync (FFImageLoading.IDecodedImage1[TNativeImageContainer] decoded, FFImageLoading.Work.ImageInformation imageInformation, System.Boolean isPlaceholder) [0x000ba] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Work\PlatformImageLoadingTask.cs:221 09-12 14:42:56.810 D/skia (23916): --- Failed to create image decoder with message 'unimplemented' 09-12 14:42:56.849 I/mono-stdout(23916): Image loading failed: passenger.svg 09-12 14:42:56.850 I/mono-stdout(23916): System.BadImageFormatException: Not a valid bitmap at FFImageLoading.Work.ImageLoaderTask3[TDecoderContainer,TImageContainer,TImageView].GenerateImageAsync (System.String path, FFImageLoading.Work.ImageSource source, System.IO.Stream imageData, FFImageLoading.Work.ImageInformation imageInformation, System.Boolean enableTransformations, System.Boolean isPlaceholder) [0x002e2] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:360 at FFImageLoading.Work.ImageLoaderTask3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x0047c] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:643

clogwog
  • 343
  • 2
  • 13
  • I don't think cached image supports svg you might wanna check this out https://github.com/luberda-molinet/FFImageLoading/wiki/SVG-support – FreakyAli Sep 12 '19 at 05:40

1 Answers1

0

Ah... well.. this in embarrassing:

FFImageLoading.Cross.MvxCachedImageView

is not the view you are looking for

FFImageLoading.Cross.MvxSvgCachedImageView

works though :)

for anyone else looking a real example looks like :

<FFImageLoading.Cross.MvxSvgCachedImageView
    android:id="@+id/iconJob"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_marginBottom="10dp"
    local:MvxBind="Click NavigateJobCommand; ImagePath 'resource://Throwaway1.ResourceLibraryWithAllSvgs.svg.taxi.svg?assembly=Throwaway1.ResourceLibraryWithAllSvgs'" />
clogwog
  • 343
  • 2
  • 13