FloatingView
FloatingView copied to clipboard
【bug】偶尔会崩溃
组件挺好用。
不过发现有点问题,在动画addUpdateListener()走到onAnimationUpdate()中时,如果Activity已被销毁,则调updateWindowManager()会导致Crash,报not attached to window manager异常。
通过加入以下判断可避免这个问题:
if (mIsShow && !mIsDetached) {
updateWindowManager();
}
其中mIsDetached是自定义的变量,在onDetachedFromWindow()中置为true.