2016-07-01 43 views

回答

1

總之:是的。

下面是這個函數的從設計支持庫中提取的ICS(Android的SKD 15)的implemntation:

@Override 
void hide(@Nullable final InternalVisibilityChangedListener listener, final boolean fromUser) { 
    if (mIsHiding || mView.getVisibility() != View.VISIBLE) { 
     // A hide animation is in progress, or we're already hidden. Skip the call 
     if (listener != null) { 
      listener.onHidden(); 
     } 
     return; 
    } 

    if (!ViewCompat.isLaidOut(mView) || mView.isInEditMode()) { 
     // If the view isn't laid out, or we're in the editor, don't run the animation 
     mView.internalSetVisibility(View.GONE, fromUser); 
     if (listener != null) { 
      listener.onHidden(); 
     } 
    } else { 
     mView.animate().cancel(); 
     mView.animate() 
       .scaleX(0f) 
       .scaleY(0f) 
       .alpha(0f) 
       .setDuration(SHOW_HIDE_ANIM_DURATION) 
       .setInterpolator(AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR) 
       .setListener(new AnimatorListenerAdapter() { 
        private boolean mCancelled; 

        @Override 
        public void onAnimationStart(Animator animation) { 
         mIsHiding = true; 
         mCancelled = false; 
         mView.internalSetVisibility(View.VISIBLE, fromUser); 
        } 

        @Override 
        public void onAnimationCancel(Animator animation) { 
         mIsHiding = false; 
         mCancelled = true; 
        } 

        @Override 
        public void onAnimationEnd(Animator animation) { 
         mIsHiding = false; 
         if (!mCancelled) { 
          mView.internalSetVisibility(View.GONE, fromUser); 
          if (listener != null) { 
           listener.onHidden(); 
          } 
         } 
        } 
       }); 
    } 
} 

動畫基本上它只是改變的知名度。

+0

很棒的回答。謝謝 –

相關問題