Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show spinner while image loads

Spinner

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.

like image 873
Ajay S Avatar asked Jun 12 '26 00:06

Ajay S


1 Answers

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"
     />
like image 120
intrepidkarthi Avatar answered Jun 20 '26 05:06

intrepidkarthi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!