Animation was realized the desktop widget cartoon method between a kind of utilization was mended
Technical field
The present invention relates to a kind of realization desktop widget cartoon method, particularly relate to a kind of between utilize mending on the standard A ndroid development platform animation realize the desktop widget cartoon method.
Background technology:
The use of the Android operating system that Google releases becomes more and more popular, especially in the application of smart mobile phone.Android SDK (abbreviation of Software Development Kit, i.e. SDK) lets exploitation Android platform application software become and is easy to, and rich and varied application program has also been accelerated the popularization of Android system in product.And the desktop widget of Android (is the visual small tool that a kind of user/system can be mutual; Such instrument provides the service of single goal; Picture shows news, weather forecast, clock, stock information, calendar function etc.) also make the desktop of Android system become colourful; User/system can self-defined desktop, puts the little plug-in unit of different Widget as required.But be subject to the degree of support of Android SDK to the Widget application development, can not be as freely the element on the interface being controlled the exploitation Activity application program.If user/system thinks about it that the effect that realization such as animation is the same on Widget can be very difficult.
Under the present technology, for realizing the Widget animation effect, the picture of ceaselessly changing among the Image View (image views) through Remote Views (remote view object) produces animation effect.The method not only expends system resource very much, and the animation effect that produces is undesirable, is difficult to the animation of realizing that some are complicated, as to have relatively high expectations.In addition, in the process of Widget animation, if define the layout animation in advance on the layout object in the Widget layout, then can be when layout be plotted to the interface for the first time to the child control generation effect of layout object.But, only be the data of interface element to be upgraded after this through the Widget frame mechanism if interface layout no longer changes, no longer generation effect of the animation that defines on the layout object.
Summary of the invention:
The objective of the invention is to overcome the deficiency of prior art; Animation realization desktop widget cartoon method between a kind of utilization benefit is provided; Be applied on the standard Google Android SDK development platform; Solved effectively when exploitation Android desktop widget application program, realized the problem that animation effect is difficult.
In order to achieve the above object; The technical scheme that the present invention adopts is: animation was realized the desktop widget cartoon method between a kind of utilization was mended; When exploitation Android desktop widget application program; In resource, define animation between benefit (animation refers to the Tween Animation in the Android SDK development platform between benefit, the initial frame and the end frame of definition animation, middle the interpolation frame of animation is drawn by the automatic computing of computing machine) also with the layout animation attributes of the layout object of this animation assignment in layout.In the operation, make animation generation effect between the benefit on the layout object in the layout through switching the Widget layout, the animation on the layout object acts on the child control in the layout object, realizes the colourful animation of Android desktop widget with this.
Animation was realized the desktop widget cartoon method between a kind of utilization was mended, and its step is following:
Step 1 is added the animation effect of animation between mending and the definition of layout in the resource of Android system, the animation effect of animation and the layout that comprises animation effect between definition is mended;
Step 2, the current layout of Widget is waited for the generation of customer incident or system event;
Step 3, customer incident or system event need produce certain animation effect N;
Step 4, the animation effect N that system's judges incident or system event need produce;
Step 5 judges whether the layout n that comprises animation effect N is the same with current layout;
Step 6, the layout n that comprises animation effect N is the same with current layout, then switches to the layout different with layout n;
Step 7; The layout n and the current layout that comprise animation effect N are different; Then switch to layout n; The animation definition that the layout animation attributes directed towards user of the layout object among the layout n or system are required, this animation will be to the child control generation effect in the layout object, and the animation effect of child control is the required animation of user or system;
Step 8 switches to the layout n that comprises animation effect N, and the Widget interface is upgraded, and the layout animation attributes of layout object animation generation effect pointed in the layout produces animation effect N.
Child control is the control that Widget supported.
Compared with prior art, the invention has the beneficial effects as follows: solved the problem of implementation of Android desktop widget animation effectively, can be applied to all Android versions of issue at present.The present invention connects in Widget application program inner room and has called animation between Android system benefit; When the developer writes application program; Only need the definition animation; Animation is realized by the Android system, can realize transparency change animation, position mobile animation, rotation animation, convergent-divergent animation and this several kinds of animations that animation combination back produces more satisfactoryly.
Description of drawings:
Fig. 1 utilizes the process flow diagram of animation realization desktop widget animation between benefit for the present invention.
Embodiment:
Be elaborated with reference to accompanying drawing below in conjunction with embodiment, so that technical characterictic of the present invention and advantage are carried out more deep annotation.
Animation was realized the desktop widget cartoon method between a kind of utilization was mended, and when exploitation Android desktop widget application program, in resource, defined animation between benefit, and with the layout animation attributes of the layout object of this animation assignment in layout.In the operation, make animation generation effect between the benefit on the layout object in the layout through switching the Widget layout, the animation on the layout object acts on the child control in the layout object, realizes the animation of Android desktop widget with this.
The present invention utilizes the process flow diagram of animation realization desktop widget animation between benefit as shown in Figure 1.After resources definition is good, in the Widget application program, produce the Widget animation effect, its step is following:
Step 1 is added the animation effect of animation between mending and the definition of layout in the resource of Android system, the animation effect of animation and the layout that comprises animation effect between definition is mended;
Step 2, the current layout of Widget is waited for the generation of customer incident or system event;
Step 3, customer incident or system event need produce certain animation effect N;
Step 4, the animation effect N that system's judges incident or system event need produce;
Step 5 judges whether the layout n that comprises animation effect N is the same with current layout;
Step 6, the layout n that comprises animation effect N is the same with current layout, then switches to the layout different with layout n;
Step 7; The layout n and the current layout that comprise animation effect N are different; Then switch to layout n; The animation definition that the layout animation attributes directed towards user of the layout object among the layout n or system are required, this animation will be to the child control generation effect in the layout object, and the animation effect of child control is the required animation of user or system;
Step 8 switches to the layout n that comprises animation effect N, and the Widget interface is upgraded, and the layout animation attributes of layout object animation generation effect pointed in the layout produces animation effect N.
Child control is the control that Widget supported.
In practical operation, the animation effect and the layout of animation between the benefit that needs in the Widget application program engineering defined.
Animation is through the XML (abbreviation of Extensible Markup Language between benefit; Be extend markup language) animation between the benefit of document definition; Can define one or more animations; The transparency change animation that each animation is supported for the Android system, position mobile animation, rotation animation, convergent-divergent animation one or more, or the combination between them, such as: the animation 1 of definition; With the animation of an XML document definition, be transparency change animation, position mobile animation, rotation animation, convergent-divergent animation one; The animation 2 of definition with the animation of an XML document definition, is transparency change animation, position mobile animation, rotation animation, convergent-divergent animation one; The animation 3 of definition with the animation of an XML document definition, is transparency change animation, position mobile animation, rotation animation, convergent-divergent animation one; The animation N of definition with the animation of an XML document definition, is transparency change animation, position mobile animation, rotates the one or more of animation, convergent-divergent animation, or the combination between them.
Animation comprises one or more layouts through the layout of XML document definition between benefit.Produce in the layout of animation effect at needs, the layout animation attributes of layout object is set at a kind of in the animation that defines in the animation between benefit.The layout object here is the layout object that Widget supported, like frame layout, linear placement and relative layout, or the combination between them, the animation that the layout animation attributes of these layout objects is pointed to will act on the child control in the layout object.Definition and layout is following: the layout 1 of definition is one of layout object of supporting of Widget; The layout 2 of definition is one of layout object of supporting of Widget; The layout 3 of definition is one of layout object of supporting of Widget; The layout n of definition is the combination between one of layout object of supporting of Widget or they.
Through the description of above embodiment, those skilled in the art can be well understood to the present invention can be implemented in call on the Android desktop widget Android system mend between animation, produce good Widget animation effect.
Although the present invention has made clear and complete description through specific embodiment to it; But invention is not limited only to said embodiment; And to one skilled in the art, all improvement and the selection made based on the present invention are contingent and all be included in the present invention.