Button is not clickable after TranslateAnimation

后端 未结 4 660
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-03 21:01

I\'m trying to move button (with animation) upon click. I want it to move 100 pixels to the bottom on first click, 100 pixels up on second, 100 pixels to the bottom on third

4条回答
  •  难免孤独
    2020-12-03 21:33

    Yes, this is normal behavior. This is because animation just rerenders View's pixels, but it's position on the display remains the same. If you want to relocate your View to the place where your animation ends, you need to call View.layout() method and pass there 4 parameters, which describe Views new position on it's layout. Keep in mind that View.layout() gets params relative to Views parent.

提交回复
热议问题