2

So I have created a loading animation view. I'm able to show the loading view in an activity.

But I want it to be a general loading animation that can be shown on top of any screen in my app. So I can call something like MyLoadingView.show(); and MyLoadingView.hide(); to control it..

I wonder how I can achieve that?

Currently, it's inside one of my activity layout:

<ImageView android:id="@+id/registration_spinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/yalo_spinner"/>

This is my spinner drawable:

<?xml version="1.0" encoding="utf-8"?>

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">

    <item android:drawable="@drawable/spinner1" android:duration="200" />
    <item android:drawable="@drawable/spinner2" android:duration="200" />
    <item android:drawable="@drawable/spinner3" android:duration="200" />
    <item android:drawable="@drawable/spinner4" android:duration="200" />
    <item android:drawable="@drawable/spinner5" android:duration="200" />
    <item android:drawable="@drawable/spinner6" android:duration="200" />
    <item android:drawable="@drawable/spinner7" android:duration="200" />
    <item android:drawable="@drawable/spinner8" android:duration="200" />

</animation-list>
xialin
  • 7,686
  • 9
  • 35
  • 66

0 Answers0