"Android" chapter 21st 2D Graphics and animations

Source: Internet
Author: User
Tags custom graphics

Category: C #, Android, VS2015;

Date Created: 2016-03-19 I. INTRODUCTION

The Android system defines a series of independent graphics processing classes, where 2D graphics processing classes are located in the following namespaces:

Android.graphices

Android.Graphics.Drawable.Shapes

Android.View.Animation

The processing class for 3D graphics is located under the Android.opengl namespace.

Overall, Android graphics technology can be broadly divided into two broad categories: graphics and animation.

The graph is further divided into 2D graphics and 3D graphics.

2D graphics processing can be divided into two basic categories: a kind of static graphics processing, used to deal with some of the non-frequent changes in the picture, the label, Logo, animation, etc., generally add these graphics as resource files to the project (resources/drawable/, resources/anim/) And the other is dynamic graphics processing, which will frequently change pictures (size, position, shape) and constantly copy and draw regularly, such as various scenes, tasks and props in the game.

3D graphics are implemented through a large number of available built-in frameworks (such as the mobile version of OpenGL ES) and other third-party frameworks (such as Monogame, a cross-platform Toolkit compatible with XNA).

This section focuses on Android's built-in 2D graphics and animation basics.

1, 2D graphices basic concept

Android provides two different APIs for creating 2D graphics.

The first is a high-level usage, which is to use it by declaring the artboard resource in an XML file. That is, you use artboard resources to embed drawing directives in an XML file, or to create custom graphics programmatically.

The second is the low-level API, which is typically used in canvas objects, and most commonly used to draw on a bitmap and control the content of its display in fine-grained terms.

2. Basic concept of animation

In addition to 2D graphics technology, Android also offers several ways to create animations:

    • Drawable animations– artboard Animation. Provides a simple animation API that plays in frames, specifying that Android will then load and display a sequence of drawing resources in sequence, much like playing a cartoon (cartoon) comic.
    • View animations-Views animation. Android's original animation API is available in all versions of Android. This API is limited to performing simple transformations in the View object, which are typically defined in the/resources/anim folder.
    • Property animations– Properties Animation. This is the API introduced from Android 3.0, which animates the properties of any object, including view. This flexibility allows animations to be encapsulated in different classes, making code sharing more convenient.

Note: The view animation is only available for APIs that were available in earlier versions of Android 3.0 (API 11). In addition, other situations should be implemented using the API provided by the property animation. In other words, although all three animations are available, you should prioritize property animations whenever possible. Second, this chapter sample main interface

1. Operation

2. Related code in Ch.cs file

Chitems.add (NewChapter () {Chaptername="21st 2D Graphics and animations", Chapteritems=Newchitem[] {NewChitem {type=typeof(ch2101mainactivity), title="Example 21-1 artboard basic syntax", Desc ="basic usage of presentation artboard resources (drawable Resource)" },        NewChitem {type=typeof(ch2102mainactivity), title="example 21-2 Canvas basic Syntax", Desc ="basic usage of the presentation canvas (canvas)" },        NewChitem {type=typeof(ch2103mainactivity), title="Example 21-3 animation basic Syntax", Desc ="Basic usage of demo animation (animation)" },    }});

"Android" chapter 21st 2D Graphics and animations

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.