I would like to make a progress bar disappear with a fade. I already saw this on other applications like the well-known SuperSU.
But I don't know how to do it.
EDIT: Here is what I did:
AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setDuration(500);
fadeOut.setFillAfter(true);
progressBar.startAnimation(fadeOut);
progressBar.setVisibility(ProgressBar.GONE);
listview.setAdapter(new MyAdapter(getApplicationContext(), listGroups, listChildren));
listview.setVisibility(ListView.VISIBLE);
AlphaAnimation fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setDuration(500);
fadeIn.setFillAfter(true);
listview.startAnimation(fadeIn);
When I start another intent and then go back, sometimes (this is quite odd, it seems to be random) the progress bar is above the listview and is frozen (not animated).
Nobody can help me? :( I tried this:
@Override
protected void onResume() {
super.onResume();
if(listview.getVisibility() == ListView.VISIBLE)
progressBar.setVisibility(ProgressBar.GONE);
}
It did not work, I still got the progress bar frozen in the middle of the listview...
AlphaAnimation fadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);//fade from 1 to 0 alpha
fadeOutAnimation.setDuration(1000);
fadeOutAnimation.setFillAfter(true)//to keep it at 0 when animation ends
myProgressBar.startAnimation(fadeOutAnimation);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With