Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当进度条消失时淡出_Android_Progress Bar_Fade - Fatal编程技术网

Android 当进度条消失时淡出

Android 当进度条消失时淡出,android,progress-bar,fade,Android,Progress Bar,Fade,我想让进度条随着淡入淡出而消失。我已经在其他应用程序上看到了这一点,比如著名的SuperSU 但我不知道怎么做 编辑: 以下是我所做的: AlphaAnimation fadeOut = new AlphaAnimation(1.0f, 0.0f); fadeOut.setDuration(500); fadeOut.setFillAfter(true); progressBar.startAnimation(fadeOut); progressBar.setVisibility(Progres

我想让进度条随着淡入淡出而消失。我已经在其他应用程序上看到了这一点,比如著名的SuperSU

但我不知道怎么做

编辑: 以下是我所做的:

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);
当我开始另一个意图,然后返回时,有时(这很奇怪,似乎是随机的)进度条位于listview上方,并且被冻结(未设置动画)

谁也帮不了我( 我试过这个:

@Override
protected void onResume() {
    super.onResume();

    if(listview.getVisibility() == ListView.VISIBLE)
        progressBar.setVisibility(ProgressBar.GONE);
}

它没有工作,我仍然把进度条冻结在ListVIEW的中间…

< P>进度条是A,并且视图可以使用,你正在寻找

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);
要创建和启动淡入淡出动画,请执行以下操作:

AlphaAnimation fadeOut;
fadeOut = new AlphaAnimation(1,0); //fade out animation from 1 (fully visible) to 0 (transparent)
fadeOut.setDuration(1000); //set duration in mill seconds
fadeOut.setFillAfter(true);
progresBar.startAnimation(fadeOut);

嗯…现在有些奇怪的事情发生了。当我开始另一个意图然后返回时,有时(这很奇怪,似乎是随机的)进度条在listview上方并且被冻结(没有动画)。我确实放了这行:fadeOutAnimation.setFillAfter(true)