diff --git a/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java b/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java index 99fc13d2..a8761645 100644 --- a/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java +++ b/library/src/main/java/uk/co/deanwild/materialshowcaseview/MaterialShowcaseView.java @@ -992,8 +992,14 @@ public boolean show(final Activity activity) { mHandler.postDelayed(new Runnable() { @Override public void run() { - - if (mShouldAnimate) { + boolean attached; + // taken from https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/core/src/main/java/androidx/core/view/ViewCompat.java#3310 + if (Build.VERSION.SDK_INT >= 19) { + attached = isAttachedToWindow(); + } else { + attached = getWindowToken() != null; + } + if (mShouldAnimate && attached) { fadeIn(); } else { setVisibility(VISIBLE);