title: Android - Animating layout using align-parent (Kotlin)
body: <p>I am needing to animate a layout from bottom to the top of the screen when the user taps on an EditText within that layout.  Here is my code for doing this:</p>
  
  <pre><code>myEditText.setOnFocusChangeListener() { _, focused -&gt;
      if (focused) {
          val animation = object: Animation() {
              override fun applyTransformation(interpolatedTime: Float, t: Transformation?) {
                  val params = myLayout.getLayoutParams() as RelativeLayout.LayoutParams
                  params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE)
                  myLayout.setLayoutParams(params)
              }
          }
          animation.duration = 1000
          myEditText.startAnimation(animation)
      }
  }
  </code></pre>
  
  <p>When I tap on the EditText, the "myLayout" properly goes to the top of the screen.  However, two issues:</p>
  
  <p>1) There is no animation, it just jumps to the top.  I am wanting it to "slide" up to the top.</p>
  
  <p>2) More importantly, the views that are set to be "below" and relative to the myLayout do not go up with it.  I know those are set properly, since when I add in the top alignment in the XML, they go up with it.  But programatically it seems they stay down below the screen, still hidden.</p>
  
  <p>I tried a different approach using ObjectAnimator, manually moving all the views up:</p>
  
  <pre><code>val anims = AnimatorSet();
  val anim1 = ObjectAnimator.ofFloat(myLayout, View.TRANSLATION_Y, -1000f)
  val anim2 = ObjectAnimator.ofFloat(layoutBelow, View.TRANSLATION_Y, -1000f)
  val anim3 = ObjectAnimator.ofFloat(layoutBelowBelow, View.TRANSLATION_Y, -1000f)
  anims.playTogether(anim1, anim2, anim3)
  anims.start()
  </code></pre>
  
  <p>Doing that makes the animation work, but the views below "myLayout" are still invisible!  I'm curious if it makes a difference that they are off-screen initially (?)</p>
  
  <p>Thoughts on what I may be missing?  If there's a better way to handle this, I'm open to different approaches as well.</p>