Home

Awesome

Build status NuGet

Xamarin.Android.AVLoadingIndicatorView

This is a Xamarin Android Binding for the AVLoadingIndicatorView.

AVLoadingIndicatorView is a collection of nice loading animations for Android.

Demo

<p align="center"> <img src="https://github.com/jzeferino/Xamarin.Android.AVLoadingIndicatorView/blob/master/art/all_loadings.gif?raw=true"/> <img src="https://github.com/jzeferino/Xamarin.Android.AVLoadingIndicatorView/blob/master/art/loading_detail.gif?raw=true"/> </p>

Usage

(see the sample project for a detailed working example)

Step 1

Install NuGet package.

Step 2

Add the AVLoadingIndicatorView to your layout:

Define xmlns:app in your root view.

xmlns:app="http://schemas.android.com/apk/res-auto"

Simple Loading

<com.wang.avi.AVLoadingIndicatorView
    android:id="@+id/avi"
    android:layout_width="wrap_content"  
    android:layout_height="wrap_content"
    app:indicatorName="BallPulseIndicator" />

Advanced Loading

<com.wang.avi.AVLoadingIndicatorView
    android:id="@+id/avi"
    android:layout_width="wrap_content"     // or your custom size
    android:layout_height="wrap_content"    // or your custom size
    style="@style/AVLoadingIndicatorView"   // or AVLoadingIndicatorView.Large or AVLoadingIndicatorView.Small
    android:visibility="visible"            // visibility
    app:indicatorName="BallPulseIndicator"  // indicator Name
    app:indicatorColor="your color" />      // indicator color

Step 3

Show or hide the progress. (starts showing by default)


protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);

    avi = FindViewById<AVLoadingIndicatorView>(Resource.Id.avi);
    avi.Show():
}  

void ShowLoading()
{
    avi.Show();
    // or avi.SmoothToShow();
}

void HideLoading()
{
    avi.Hide();
    // or avi.SmoothToHide();
}
   

Using programmatically

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);

    var avLoadingIndicatorView = new AVLoadingIndicatorView(this);
    avLoadingIndicatorView.SetIndicator("SquareSpinIndicator");
    AddContentView(avLoadingIndicatorView, new ViewGroup.LayoutParams(80, 80));
}            

Proguard

When using proguard need to add this rules:

-keep class com.wang.avi.** { *; }
-keep class com.wang.avi.indicators.** { *; }

Indicators are loaded from class names, proguard may change it (rename).

Indicators

As seen above in the Demo, the indicators are as follows:

Row 1

Row 2

Row 3

Row 4

Row 5

Row 6

Row 7

License

MIT Licence