Show spinner while image loads

android, android-imageview

Solution

Have ImageView and a ProgressBar inside a FrameLayout. Inside your OnCreate() method add this,

progressBar.setVisibility(View.VISIBLE);
imageView.setVisibility(View.INVISIBLE);

Load your image now. After loading it, call this:

progressBar.setVisibility(View.INVISIBLE);
imageView.setVisibility(View.VISIBLE);

ProgressBar

 <ProgressBar
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     style="@android:style/Widget.ProgressBar.Small"
     />

Problem

I want to show this image in Imageview as the default. I set it up as a Bitmap, but it's not spinning. Please, help me show the spinning image.

Original source