Cross platform library to change loader image.
You can integrate the loader in Xamarin Form application using following code:
Shared Code -
using Xamarians;
...
StackLayout loaderLayout = await Loader.RegisterLoader(this, Image name with extention, Message to show with loader);
...
loaderLayout.IsVisible = true; //This will present the loader layout.
...
loaderLayout.IsVisible = false; //This will hide the loader layout.
Android -
-
Add loader image in Assets folder.
-
Add dependency service as given below.
using Xamarians.Interfaces;
...
[assembly: Xamarin.Forms.Dependency(typeof(GifImageUrl))]
...
public class GifImageUrl : IGif
{
public string GetGifImageUrl()
{
return "file:///android_asset/";
}
}
iOS -
-
Add loader image in the Resources folder.
-
Add dependency service as given below.
using Xamarians.Interfaces;
...
[assembly: Xamarin.Forms.Dependency(typeof(GifImageUrl))]
...
public class GifImageUrl : IGif
{
public string GetGifImageUrl()
{
return Foundation.NSBundle.MainBundle.BundlePath;
}
}