The menu effect of the original path is so simple. Layout +translateanimation finish and high imitation Millet launcher (zaker) Drag the item 02-29 up-to-date update

Source: Internet
Author: User
Tags zip

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


An animated effect that extracts the menu from the next path. Look at the stickers first.


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

Principle:
Click on 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 when the move animation appears. Hidden is the
Animation Animation = new Translateanimation (0f,mlp.rightmargin-xoffset, 0f,yoffset + mlp.bottommargin);

where Xoffset yoffset 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 (context context) {//By layout file
Xoffset = (int) (10.667 *context.getresources (). Getdisplaymetrics (). density);
Yoffset =-(int) (8.667 *context.getresources (). Getdisplaymetrics (). density);
}
Figure below

It is worth mentioning that the use of interpolator, path in the use of Overshootinterpolator and Anticipateinterpolator.
Interpolator is used to modify the animation effect, define the rate of change of the animation, can make the existing animation effect can accelerated (acceleration), decelerated (deceleration), repeated (repetition), 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 change is slow, and then start to accelerate
Anticipateinterpolator starts back and then moves forward.
Anticipateovershootinterpolator starts back and then dumps a certain value and returns the last value.
Bounceinterpolator animation at the end of the play
Cycleinterpolator Animation Loop plays a specific number of times, rate changes along the sine curve
Decelerateinterpolator in the beginning of the animation and then slowly
Linearinterpolator change at constant rate
Overshootinterpolator forward a certain value before returning to its original position.

Thanks to the little Bear fart tireless effort, added the button item click to enlarge the animation
Code Pathmenu.zip (1.3 MB, download number: 367)

Another modification: Added a statement that removes the six button focus after the end of the animation, preventing the event from blocking to the layer below.


High Imitation Millet launcher (zaker) Drag across screen item 02-29 latest update

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

Trigger long press 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 Diagram:

Source: Milaucher.zip (1.05 MB, download number: 236)
Added sliding effect to make the experience smoother
Milaucher2.zip (1.06 MB, download number: 132)
Long press the item disappears and pops up, releasing animation changes
Milaucher3.zip (1.06 MB, download number: 131)
Added features to support multiple GridView with left and right swipe
Milaucher4.zip (1.43 MB, download number: 137)
Added the ability to drag item replacement locations across screens
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.