How to make page turning effect in Android?

后端 未结 1 1666
孤独总比滥情好
孤独总比滥情好 2020-12-28 10:54

Can any one tell me how to make page turn effect in Android?
Can any one please provide me some code snippet.

相关标签:
1条回答
  • 2020-12-28 11:20

    Take a look at this.

    It's a Calculator application, which changes between normal/scientific mode on swipe gesture:

    onFling(MotionEvent, MotionEvent, float, float)
    

    It uses TranslateAnimation to accomplish the effect, but dragging between the views and tracking your finger, like in the iPhone is not implemented. Try using

    onScroll(MotionEvent, MotionEvent, float, float)
    

    for that.

    As for Flexbook-like component, it shouldn't be hard to implement, if you use the masking approach.

    Android M3 (pre-1.0 version) even had PageTurner widget, but it got deprecated, since it wasn't generic-enough, like the other widgets. You can try and dig up the old Android sources to find the implementation of PageTurner and modify it for Cupcake/Donut.

    0 讨论(0)
提交回复
热议问题