At this point, the control for book flip is almost done. The control for single-page book flip is roughly the same as that for previous book flip. The previous control displays two pages at a time, considering that the screen size may not necessarily reach the normal ratio of 2 pages, in order not to cause deformation, I continued to write this single-page flip control.
Many netizens are interested in my code. However, due to the company's confidentiality agreement, the Code cannot be published, so we can only provide technical guidance here. Sorry.
It is not difficult to write this control. It should be easy for people who have written Android games to use surfaceview animation to implement special effects. In addition, there is a key code:
View. Draw (canvas );
With this code, you can draw a Layout View (that is, the rendered view) into a canvas object. Set canvas as follows:
Bitmap tmpbmp = bitmap. createbitmap (contentwidth, contentheight, bitmap. config. argb_8888 );
Canvas mcanvas = new canvas (tmpbmp );
Then draw the Layout View Into the canvas, so that the content in tembmp is all the content of the view, which is equivalent to a screenshot. Then, in the corresponding event, calculate the location angle and draw tmpbmp into surfaceview.
The results of single-page book turning are as follows: