Using Animation to swipe views

后端 未结 2 1371
轻奢々
轻奢々 2021-01-15 02:12

I have a FrameLayout that recognize swipe gestures (up and down).

For example: if a swipe up are performed, I should animate the current view (that is MATCH_PARENT x

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 03:14

    If you want to actually switch views, you need to implement an AnimationListener that takes care of the animation. If you want more complex behavior like a "finger following" scroller between views, you will likely have to use something a bit more complex, but if you're just saying

    if(I flicked upwards)
        move view up
    

    then AnimationListener is perfect for you. Just make sure you set the listener to the Animation in code.

    Hope this helps!

提交回复
热议问题