Imitation QQ5.0 above the new version of the skid effect

Source: Internet
Author: User

1, this effect uses the csdn of the Great God Sun's prestige code case in this thanks attached reference blog address:

http://blog.csdn.net/manoel/article/details/39013095/#plain

2, Slidingmenu Library does not need to modify, get down can be used directly

3, the code in the demo is to support one-sided, I just add a two-sided support, of course, this is only two sides of the effect is achieved, there is not perfect place, is the side of the main interface will have a part of the layout of the actual existence but do not see the situation, this people use when you will find that the general slightly careless

4, when the main interface layout and the hidden Slidingmenu main layout at the same time, the right side slide will have a black line flashing, currently do not know how to solve

Attached

Main interface Layout All code: (here on both sides of the fragment I do not post, make a blank view can be, the layout is relatively simple, a little foundation can write)

Package Com.sunguowei.residemenu;import Android.graphics.canvas;import Android.os.bundle;import Android.support.v4.app.fragment;import Android.util.log;import Android.view.view;import Android.view.view.onclicklistener;import Android.widget.button;import Android.widget.textview;import Com.jeremyfeinstein.slidingmenu.lib.slidingmenu;import Com.jeremyfeinstein.slidingmenu.lib.slidingmenu.canvastransformer;import Com.jeremyfeinstein.slidingmenu.lib.app.slidingfragmentactivity;import Com.sunguowei.callback.callback;public Class Mainactivity extends slidingfragmentactivity implements Onclicklistener,callback/*implements Ongesturelistener    */{private static final String tag= "mainactivity";    Private Fragment mcontent;   Slidingmenu sm = null;     Private Canvastransformer Mtransformer;           Private Canvastransformer MTransformer2;   Private Button Button_main_open_left;   Private Button button_main_open_right;    Private TextView Main_one; @Override public void OnCreate (Bundle saveDinstancestate) {super.oncreate (savedinstancestate);                Setcontentview (r.layout.layout_content);        Button_main_open_left = (Button) Findviewbyid (r.id.button_main_open_left);        Button_main_open_right = (Button) Findviewbyid (r.id.button_main_open_right);        Main_one = (TextView) Findviewbyid (R.id.main_one);        Button_main_open_left.setonclicklistener (this);        Button_main_open_right.setonclicklistener (this);        Setbehindcontentview (R.layout.menu_frame);        Getsupportfragmentmanager (). BeginTransaction (). Replace (R.id.menu_frame, New Menufragment ()). commit (); Main interface Mtransformer = new Canvastransformer () {@Overridepublic void Transformcanvas (canvas canvas, float percentopen                {//float scale = (float) (percentopen*0.25 + 0.75), float scale = (float) (1-percentopen * 0.25);              Canvas.scale (scale, scale, canvas.getwidth ()/2, Canvas.getheight ()/2); }};//background layer Animation mTransformer2 = new Canvastransformer () {@Overridepublic void Transformcanvas (canvas canvas, float percentopen) {Float scale = (float) (Percentopen * 0.25 + 0.75);           Canvas.scale (scale, scale, 0, Canvas.getheight ()/2);        }};        SM = Getslidingmenu ();        Sm.setsecondarymenu (r.layout.menu_frame2);        Getsupportfragmentmanager (). BeginTransaction (). Replace (r.id.menu_frame2, New MenuFragment2 ()). commit ();        Sm.setbehindoffsetres (R.dimen.slidingmenu_offset);        Sm.setfadeenabled (FALSE);        Sm.setbehindscrollscale (0.25f);        Sm.setfadedegree (0.75f);        Sm.setmode (slidingmenu.left_right);//Sm.settouchmodeabove (Slidingmenu.touchmode_fullscreen);        Sm.setbackgroundimage (R.drawable.img_frame_background);        Sm.setbehindwidth ((int) (Getwindowmanager (). Getdefaultdisplay (). GetWidth ()/1.35));        Sm.setbehindcanvastransformer (MTRANSFORMER2);           Sm.setabovecanvastransformer (Mtransformer); } @Overridepublic void OnClick (View v) {//TODO AuTo-generated Method Stubswitch (V.getid ()) {case r.id.button_main_open_left:settoggle (); Break;case R.id.button_main_ Open_right:sm.showSecondaryMenu (); break;default:break;}} public void Settoggle () {toggle ();} @Overridepublic void Successtext (String text) {//TODO auto-generated method stublog.i (TAG, "==-->text:=" +text); main _one.settext (text);}}

Imitation QQ5.0 above the new version of the skid effect

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.