Android custom control single-page flip Control

Source: Internet
Author: User
Tags android games

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:

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.