I created a RecyclerView which I want to animate by clicking on the CardView inside it. I want to apply this animation of material design which resize the selected item and push up the item below and push down the item above :

I tried with this code but it just collapses and expands without pushing the item below :
     private void expandCardView()
 {
      mCardViewContent.setVisibility(View.VISIBLE);
      final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
      final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
      mCardViewContent.measure(widthSpec, heightSpec);
      ValueAnimator mAnimator = slideAnimator(0, mCardViewContent.getMeasuredHeight());
      mAnimator.start();
 }
 private void collapseCardView ()
 {
      int finalHeight = mCardViewContent.getHeight();
      ValueAnimator mAnimator = slideAnimator(finalHeight, 0);
      mAnimator.addListener(new AnimatorListenerAdapter()
      {
           @Override
           public void onAnimationEnd(Animator animator)
           {
                mCardViewContent.setVisibility(View.GONE);
           }
      });
      mAnimator.start();
 }
 private ValueAnimator slideAnimator(int start, int end)
 {
      ValueAnimator animator = ValueAnimator.ofInt(start, end);
      animator.addUpdateListener(valueAnimator->
      {
           int value = (Integer) valueAnimator.getAnimatedValue();
           ViewGroup.LayoutParams layoutParams = mCardViewContent.getLayoutParams();
           layoutParams.height = value;
           mCardViewContent.setLayoutParams(layoutParams);
      });
      return animator;
 }
 
    