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_Android Progressbar - Fatal编程技术网

Android 如何确保进度条已停止

Android 如何确保进度条已停止,android,android-progressbar,Android,Android Progressbar,我知道要“停止”ProgressBar,需要将其可见性设置为View.GONE。但是这真的能阻止它吗?背景中有一个动画,可以为视图设置动画。该动画是否在检测到进度条已消失后停止或不可见?我真的不想在不需要的时候让进度条在后台持续运行。这是对处理能力的浪费 有人知道吗?看着ProgressBar.java我发现: /** * Returns whether the ProgressBar is animating or not. This is essentially the same * a

我知道要“停止”ProgressBar,需要将其可见性设置为
View.GONE
。但是这真的能阻止它吗?背景中有一个动画,可以为视图设置动画。该动画是否在检测到进度条已消失后停止或不可见?我真的不想在不需要的时候让进度条在后台持续运行。这是对处理能力的浪费


有人知道吗?

看着
ProgressBar.java
我发现:

/**
 * Returns whether the ProgressBar is animating or not. This is essentially the same
 * as whether the ProgressBar is {@link #isIndeterminate() indeterminate} and visible,
 * as indeterminate ProgressBars are always animating, and non-indeterminate
 * ProgressBars are not animating.
 *
 * @return true if the ProgressBar is animating, false otherwise.
 */
public boolean isAnimating() {
    return isIndeterminate() && getWindowVisibility() == VISIBLE && isShown();
}

void startAnimation() {
    if (getVisibility() != VISIBLE || getWindowVisibility() != VISIBLE) {
        return;
    }
    ...


@Override
protected void onDetachedFromWindow() {
    if (mIndeterminate) {
        stopAnimation();
    }
    ...
我认为,
ProgressBar
将在隐藏后停止动画