The original Path menu effect is so simple. Layout +translateanimation handle and high imitation Millet launcher (zaker) cross-screen drag item 02-29 latest update

Source: Internet
Author: User
Tags zip

Http://www.eoeandroid.com/thread-157511-1-1.html


Extract the animation effect of the next path menu. Look at the map first.


Source: Pathmenu.zip (1.3 MB, download times: 466)
Effect APK:PathMenu.apk (466.77 KB, download times: 57)

Principle:
Click the red plus sign to trigger the event:
public static void Startanimationsin (ViewGroup viewgroup,int durationmillis) {
for (int i = 0; i < Viewgroup.getchildcount (); i++) {
ImageButton Inoutimagebutton = (ImageButton) viewgroup
. Getchildat (i);
Inoutimagebutton.setvisibility (0);
Marginlayoutparams MLP = (marginlayoutparams) inoutimagebutton.getlayoutparams ();
Animation Animation = new Translateanimation (Mlp.rightmargin-xoffset,0f,yoffset + mlp.bottommargin, 0F);
This place is the difference between the relative and absolute position, in fact, there are 4 parameters are not shown, but she will automatically identify according to the unit. The original sentence should be:
New Translateanimation (Animation.absolute,mlp.rightmargin-xoffset, animation.relative_to_self,0f, Animation.absolute, Yoffset + mlp.bottommargin, animation.relative_to_self,0f);

Animation.setfillafter (True); Animation.setduration (Durationmillis);
Animation.setstartoffset ((i * 100)
/( -1 + viewgroup.getchildcount ());
Animation.setinterpolator (New Overshootinterpolator (2F));
Inoutimagebutton.startanimation (animation);

}
The copy code occurs with a move animation. Hidden is
Animation Animation = new Translateanimation (0f,mlp.rightmargin-xoffset, 0f,yoffset + mlp.bottommargin);

Where Xoffset Yoffset is the distance from the screen margin from the end item in the layout.
private static int xoffset = 15;
private static int yoffset =-13;
public static void Initoffset {//by layout file
Xoffset = (int) (10.667 *context.getresources (). Getdisplaymetrics (). density);
Yoffset =-(int) (8.667 *context.getresources (). Getdisplaymetrics (). density);
}
The following figure

It is worth mentioning the use of interpolator, the path of the use of Overshootinterpolator and Anticipateinterpolator.
Interpolator is used to modify the animation effect, define the rate of change of animation, can make the existing animation effect can be accelerated (acceleration), decelerated (deceleration), repeated (repeat), bounced (bounce) and so on.
Acceleratedecelerateinterpolator at the beginning of the animation with the introduction of the local rate change slower, in the middle of the time to accelerate
Accelerateinterpolator at the beginning of the animation, the rate changes slowly, and then starts to accelerate
Anticipateinterpolator starts back and forwards.
Anticipateovershootinterpolator the last value when you start backwards and then forward a certain value
Bounceinterpolator animation at the end of the play
Cycleinterpolator animation loops play a specific number of times, the rate changes along the sine curve
Decelerateinterpolator at the beginning of the animation fast and slow
Linearinterpolator change at constant rate
Overshootinterpolator forward a certain value and then back to the original position

Thanks to the hard work of the Little Bear fart, add the button item click to enlarge the animation
Code Pathmenu.zip (1.3 MB, download times: 367)

Another modification: Add a statement that removes the six button focus after the animation is finished, preventing the event from being blocked to the level below.


High Imitation Millet launcher (zaker) cross-screen drag item 02-29 latest update

Http://www.eoeandroid.com/thread-155299-1-1.html

Trigger long by event after floating principle:
Windowparams = new Windowmanager.layoutparams ();
windowparams.gravity = Gravity.top | Gravity.left;
Windowparams.x = X-ITEMWIDTH/2;
Windowparams.y = Y-ITEMHEIGHT/2;
Windowparams.height = WindowManager.LayoutParams.WRAP_CONTENT;
Windowparams.width = WindowManager.LayoutParams.WRAP_CONTENT;

ImageView IV = new ImageView (GetContext ());
Iv.setimagebitmap (BM);
WindowManager = (WindowManager) getcontext (). Getsystemservice (
Context.window_service);//"Window"
Windowmanager.addview (iv, Windowparams);
Drag effect:
if (Dragimageview!= null) {
Windowparams.alpha = 0.6f;
Windowparams.x = X-ITEMWIDTH/2;
Windowparams.y = Y-ITEMHEIGHT/2;
Windowmanager.updateviewlayout (Dragimageview, windowparams);
}
Effect Chart:

Source: Milaucher.zip (1.05 MB, download times: 236)
Increases the sliding effect and makes the experience smoother
Milaucher2.zip (1.06 MB, download times: 132)
Long press item disappears and pops up, releasing animation changes
Milaucher3.zip (1.06 MB, download times: 131)
Added the ability to support multiple GridView with left and right sliding
Milaucher4.zip (1.43 MB, download times: 137)
Added the ability to drag the item alternate position across the screen
SOURCE   MiLaucher5.zip  (1.09 MB, download times: 252)  

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.