title: How to animate layout from top to 300dp of screen vice versa in android?
body: <h2>Requirement</h2>
  
  <p>I can translate layout base on <code>toYDelta="100%</code> or <code>toYDelta="50%</code> etc.</p>
  
  <p>But I want to animate layout only in <code>300dp Height</code>.</p>
  
  <h2>slide_down.xml</h2>
  
  <pre><code>&lt;translate xmlns:android="http://schemas.android.com/apk/res/android"
      android:duration="500"
      android:fromYDelta="0"
      android:toYDelta="100%" /&gt;
  </code></pre>
  
  <h2>slide_up.xml</h2>
  
  <pre><code>&lt;translate xmlns:android="http://schemas.android.com/apk/res/android"
      android:duration="500"
      android:fromYDelta="100%"
      android:toYDelta="0" /&gt;
  </code></pre>
  
  <h2>Java Code (Animation)</h2>
  
  <pre><code>Animation animation = AnimationUtils.loadAnimation(getActivity().getApplicationContext(),R.anim.slide_down);
  animation.setAnimationListener(new AnimationListener() {
  
      @Override
      public void onAnimationStart(Animation animation) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void onAnimationRepeat(Animation animation) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void onAnimationEnd(Animation animation) {
          // TODO Auto-generated method stub
  
          // I can hide layout after animation completion 
  
      }
  });
  </code></pre>
  
  <h2>Mockup</h2>
  
  <p><img src="https://i.stack.imgur.com/894cX.gif" alt="Animation Mockup"></p>
  
  <h2>Problem</h2>
  
  <p>How to do base on 300dp height?</p>
  
  <p>Please help me for this problem.</p>
  
  <p>Thank you.</p>