Android Interview Collection 2D graphics and animation technology

Source: Internet
Author: User

1. How do I draw graphics on the windows of an android application?
    • Inherit view
    • Implementing the OnDraw () method in view

2. How do I draw a circle, hollow ellipse?
    • Canvas.drawarc or Canvas.drawcircle method to draw a circle
    • Canvas.drawarc (Rectangle object, 0,360,true,paint);

3. Two ways to draw bitmaps?
    • Law 1:canvas.drawbitmap (bitmap,10,10,null); Draw on the canvas
    • Law 2:drawable.draw (canvas); Paste the picture onto the canvas

4. How do I set the transparency of an image?
    • Paint.setalpha (99);

5. How do I rotate a graphic?
    • Matrix matrix=new Matrix ();
    • Matrix.setrotate (120, coordinates 1, coordinates 2); Rotate 120 degrees by coordinates
    • Canvas.setmatrix (matrix);

6. How do I animate with view?
    • Keep your phone screen refreshed by calling the View.invalidate method

7. What kinds of paths are supported by the drawing API of the Android SDK?
    • Cornerpatheffect class: Converts the angle between the segment and the segment into rounded corners.
    • Dashpatheffect class: This class is used to draw dashed paths.
    • Pathdashpatheffect class: This class can be composed of a dashed path alone.
    • Composepatheffect class: This class can combine two effects together.

8. How to implement a circular display of text rendering?
    • Use Canvas.drawtextonpath ("text", path,-55,0,paint);

9. How do I control the looping of frame animations?
    • Static configuration: Set the Android:oneshot property in the frame animation file
    • Dynamic configuration: Using the Animationdrawable.setoneshot method

What kinds of tweened animations are supported by the 10.Android SDK?
    • Move motion Tween animations
    • Rotate motion Tween animations
    • Scale motion Tween animations
    • Transparency Tween Animations

11. How do I customize the animation renderer?
    • Custom class Implementation Interpolator interface
    • Use animation to call the renderer together
    • Note: Custom renderers cannot be specified by the Android:interpolator property in the XML file.

Android Interview Collection 2D graphics and animation technology

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.