Code example for ViewPropertyAnimator

Methods: alpha, setDuration, setListener, start

0
        view.setLayoutParams(new GridLayout.LayoutParams(params));
    } 
 
    public void setEnabled(final View view, boolean enabled) {
        ViewPropertyAnimator animator = view.animate(); 
        animator.setDuration(300); 
 
        if (enabled) { 
            animator.alpha(1f); 
            animator.setListener(new AnimatorListenerAdapter() { 
                @Override 
                public void onAnimationStart(Animator animator) { 
                    view.setEnabled(true); 
                } 
            }); 
        } else { 
            animator.alpha(0.7f); 
            animator.setListener(new AnimatorListenerAdapter() { 
                @Override 
                public void onAnimationStart(Animator animator) {
                    view.setEnabled(false); 
                } 
            }); 
        } 
        animator.start(); 
    } 
 
    public abstract int execute(Editable editable, int position);
    public abstract void setEnabled(boolean enabled);
}