问题
I am learning android and trying to create an effect of folding the view from middle like one in the linked video.
http://vimeo.com/37254322
Can anybody give some guidance or point to the right resource.
Current android allows to flip the complete view on Z axis to create a view flip effect as shown in video below.
http://www.youtube.com/watch?v=a5b0EKUU3h4
Code found here for flip effect http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html
But the effect in first video folds it from middle. Also I would like to use that effect as transition animation which hides the top view and display one from behind with a viewGroup.
Thanks
回答1:
You would need to perform the following tasks which can each be asked in their own question (This is as simple a solution as I can think of):
You will need to capture "Page 1" and "Page 2" as Separate entities (this could be done by compilation of the View Heirachy of Canvas' or through some screenshot technique.)
Add "Page 4" underneath "Page 2" so it's visible as the View above it shrinks.
You can apply an animation to "Page 2" which shrinks it's width value. For extra effect this could also include a shadow appearing on the page, page egde and page top/bottom animations.
Layer "Page 3" above "Page 1" with a width of 0 and with an x value of half of the screen width. Have the width if this View begin to grow and translate it's x value left at the same rate. Add extra shadow / page edge / page bottom.
Remove the original "Page 1" and "Page 2".
来源:https://stackoverflow.com/questions/9940605/how-to-fold-view-from-middle-in-android