Android view class and Surfaceview class detailed _android

Source: Internet
Author: User

The main class of Android game development is display class except control class, and it is very important and complicated to display and game logic processing. Display and canvas can be implemented in J2ME, and the view class is displayed in Android. Here is a brief introduction to Android.view.View and Android.view.SurfaceView.

Surfaceview is a display class derived from the view base class, and the direct subclass has Glsurfaceview and Videoview to see how the GL and video playback and camera cameras generally use surfaceview, what are the advantages?  Surfaceview can control the surface of the format, such as size, display in the screen position, the most critical is to provide the Surfaceholder class, using the Getholder method to obtain, related to Canvas Lockcanvas (), Canvas Lockcanvas (Rect dirty), void Removecallback (Surfaceholder.callback Callback), void Unlockcanvasandpost (Canvas Canvas) Control graphics and drawing, and in the Surfaceholder.callback interface callback you can define specific implementations (such as the first change format and display screen) by following three abstract classes:

abstract void surfacechanged (surfaceholder holder, int format, int width, int height);

abstract void surfacecreated (Surfaceholder holder);

abstract void surfacedestroyed (Surfaceholder holder);

For surface-related, the Android bottom also provides GPU acceleration, so the main use of surfaceview in real time applications is not directly built from view, The Glsurfaceview in OpenGL, which is also mentioned later, is implemented from this class.

Above on the Android view class and surface details, I hope to help Android development friends, thank you for your support to the site, follow-up to continue to supplement the relevant information.

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.