Android — How to position View off-screen?

后端 未结 6 2048
鱼传尺愫
鱼传尺愫 2020-11-28 01:08

I\'m trying to animate a simple ImageView in my application and I want it to slide in from the bottom of the screen and come to a resting position where the top 50px of the

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 01:55

    I had a viewgroup with children and was dragging the view into the screen from the bottom - kind of like a drawer. I then would let go and if the viewgroup top margin were in the top half of the screen I would animate it to the top after the user released the touch.

    When this happened the images in the viewgroup's children would get cropped during the animation but would then get shown after the animation.

    The problem: viewgroup's height was wrap_content. I solved this by setting the height to a value that stretched off the screen before the animation started.

提交回复
热议问题