@@ -1208,6 +1208,9 @@ public void onAnimationEnd(Animator anim) {
12081208 * affect CHANGE_APPEARING or CHANGE_DISAPPEARING animations.
12091209 */
12101210 private void addChild (ViewGroup parent , View child , boolean changesLayout ) {
1211+ if (parent .getWindowVisibility () != View .VISIBLE ) {
1212+ return ;
1213+ }
12111214 if ((mTransitionTypes & FLAG_APPEARING ) == FLAG_APPEARING ) {
12121215 // Want disappearing animations to finish up before proceeding
12131216 cancel (DISAPPEARING );
@@ -1243,6 +1246,9 @@ private void addChild(ViewGroup parent, View child, boolean changesLayout) {
12431246 * @hide
12441247 */
12451248 public void layoutChange (ViewGroup parent ) {
1249+ if (parent .getWindowVisibility () != View .VISIBLE ) {
1250+ return ;
1251+ }
12461252 if ((mTransitionTypes & FLAG_CHANGING ) == FLAG_CHANGING && !isRunning ()) {
12471253 // This method is called for all calls to layout() in the container, including
12481254 // those caused by add/remove/hide/show events, which will already have set up
@@ -1301,6 +1307,9 @@ public void showChild(ViewGroup parent, View child, int oldVisibility) {
13011307 * affect CHANGE_APPEARING or CHANGE_DISAPPEARING animations.
13021308 */
13031309 private void removeChild (ViewGroup parent , View child , boolean changesLayout ) {
1310+ if (parent .getWindowVisibility () != View .VISIBLE ) {
1311+ return ;
1312+ }
13041313 if ((mTransitionTypes & FLAG_DISAPPEARING ) == FLAG_DISAPPEARING ) {
13051314 // Want appearing animations to finish up before proceeding
13061315 cancel (APPEARING );
0 commit comments