title: ¿How make the correct animation? (Android java without xml)
body: <p>I have the next code: </p>
  
  <pre><code>public void desaparecer(final LinearLayout parent, View hijo, int espaciofinal) {
  
          parent.removeView(hijo); //remote the view of the parent
  
          final LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)parent.getChildAt(0).getLayoutParams(); //create the params
  
          final int espacioIni = parent.getChildAt(0).getHeight(); //i get the height from start
  
          ValueAnimator animator = ValueAnimator.ofInt(params.height, espaciofinal); //pass the params and the final height
  
          animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(ValueAnimator valueAnimator) {
  
                  params.height = (Integer) valueAnimator.getAnimatedValue();
                  parent.getChildAt(0).requestLayout(); //request
              }
          });
          animator.setDuration(300); //set the anim duration   
  
          animator.start(); //start the animation
  
      }
  </code></pre>
  
  <p>The animation don't work well. The idea would be that start the animation with the initial height. (This would be the correct way) </p>
  
  <p>But, by reasons that i don't understand, the height (when start the animation) pass to be 0 and i need that don't destroy the original height. </p>
  
  <p>Any idea? I accept all ideas, except xml sources. I can't use it by reasons of my team. </p>
  
  <p>Thx.</p>