This is a Xamarin Android Binding for the AVLoadingIndicatorView.
AVLoadingIndicatorView is a collection of nice loading animations for Android.
(see the sample project for a detailed working example)
Install NuGet package.
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
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();
}
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
var avLoadingIndicatorView = new AVLoadingIndicatorView(this);
avLoadingIndicatorView.SetIndicator("SquareSpinIndicator");
AddContentView(avLoadingIndicatorView, new ViewGroup.LayoutParams(80, 80));
}
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).
As seen above in the Demo, the indicators are as follows:
Row 1
BallPulseIndicator
BallGridPulseIndicator
BallClipRotateIndicator
BallClipRotatePulseIndicator
Row 2
SquareSpinIndicator
BallClipRotateMultipleIndicator
BallPulseRiseIndicator
BallRotateIndicator
Row 3
CubeTransitionIndicator
BallZigZagIndicator
BallZigZagDeflectIndicator
BallTrianglePathIndicator
Row 4
BallScaleIndicator
LineScaleIndicator
LineScalePartyIndicator
BallScaleMultipleIndicator
Row 5
BallPulseSyncIndicator
BallBeatIndicator
LineScalePulseOutIndicator
LineScalePulseOutRapidIndicator
Row 6
BallScaleRippleIndicator
BallScaleRippleMultipleIndicator
BallSpinFadeLoaderIndicator
LineSpinFadeLoaderIndicator
Row 7
TriangleSkewSpinIndicator
PacmanIndicator
BallGridBeatIndicator
SemiCircleSpinIndicator