how to fold view from middle in android?

你离开我真会死。 提交于 2019-12-05 05:03:43

问题


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):

  1. 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.)

  2. Add "Page 4" underneath "Page 2" so it's visible as the View above it shrinks.

  3. 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.

  4. 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.

  5. Remove the original "Page 1" and "Page 2".



来源:https://stackoverflow.com/questions/9940605/how-to-fold-view-from-middle-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!