ANDROID:QQ Multi-Slide Menu implementation

Source: Internet
Author: User

In this article, I wrote

self-defined horizontalscrollview realization QQ side Slide Menu

However, this menu effect is just a normal side-pull effect and we can also implement a drawer-style side-slip menu like this

The first kind of effect

An additional effect

The third kind of effect

The fourth kind of effect

The other code is the same as in the previous article, only in Myhorizontalscrollview.class rewrite onscrollchanged this method

The first kind of side slip effect code is very easy

@Overrideprotected void onscrollchanged (int l, int t, int oldl, int Oldt) {//TODO auto-generated method Stubsuper.onscrol Lchanged (L, T, OLDL, Oldt); Viewhelper.settranslationx (Mmenu, L);}
L=GETSCROLLX () in Mmenu x-coordinate offset by Settranslationx method

This side-slip effect can be achieved by setting these

Another side-slip effect code is similar to the first one. Just add 1 time times the offset to the x-coordinate of the mmenu, making the Mmenu menu seem to come out from the right.

@Overrideprotected void onscrollchanged (int l, int t, int oldl, int Oldt) {//TODO auto-generated method Stubsuper.onscrol Lchanged (L, T, OLDL, Oldt); Viewhelper.settranslationx (Mmenu, 2*l);}

For the third side-slip effect, we find that the zoom animation is used, so there is a 0~1 change rate because the initial l=getscrollx () =mmenuwidth. Finally l=0 so from here we can get

Scale 1~0 rate of change float scale = l*1.0f/mmenuwidth;

Code such as the following

@Overrideprotected void onscrollchanged (int l, int t, int oldl, int Oldt) {//TODO auto-generated method Stubsuper.onscrol Lchanged (L, T, OLDL, Oldt);//scale 1~0 rate of change float scale = l*1.0f/mmenuwidth;//content scaling 1~0.7float rightscale=scale* 0.3f+0.7f;//Setting the Zoom Center Viewhelper.setpivotx (mcontent,0); Viewhelper.setpivoty (Mcontent,mcontent.getheight ()/2);//Zoom Viewhelper.setscalex (mcontent, RightScale); Viewhelper.setscaley (Mcontent, RightScale);}

As for this, why do I set the Zoom center to Mcontent x=0 Y=HEIGHT/2 is to make the distance between the left side and the right side of the screen unchanged after the side slip, otherwise the distance will also be scaled


The fourth effect we'll find is that compared to the third, but the left side of the Mmenu effect will be found to be scaled and transparent

Code such as the following

@Overrideprotected void onscrollchanged (int l, int t, int oldl, int Oldt) {//TODO auto-generated method Stubsuper.onscrol Lchanged (L, T, OLDL, Oldt);//scale 1~0 rate of change float scale = l*1.0f/mmenuwidth;//content scaling 1~0.7float rightscale=scale* 0.3f+0.7f;//menu Transparency Change 0~1float leftalpha=1.0f-scale;//menu Zoom change 0.3-1.0float leftscale=1.0f-scale*0.7f;// Mcontent Setting the Zoom Center Viewhelper.setpivotx (mcontent,0); Viewhelper.setpivoty (Mcontent,mcontent.getheight ()/2)//mcontent Zoom Viewhelper.setscalex (mContent, RightScale); Viewhelper.setscaley (Mcontent, RightScale);/* * Zoom and set transparency for Mmenu * */viewhelper.setscalex (Mmenu, Leftscale); Viewhelper.setscaley (Mmenu, Leftscale); Viewhelper.setalpha (Mmenu, Leftalpha);}
To achieve this effect.

These two days I also try to do the effect of the rectangular flip of the emulator on the real machine on the not on the feeling of wasting a lot of time O (︶^︶) o Alas

The side pull effect on qqv6.2.3 is

We just need to reduce the Mmenu x-coordinate offset to implement code such as the following

@Overrideprotected void onscrollchanged (int l, int t, int oldl, int Oldt) {//TODO auto-generated method Stubsuper.onscrol Lchanged (L, T, OLDL, Oldt); Viewhelper.settranslationx (Mmenu, l*0.6f);}

Effect

These animations may seem very easy to others. I've been thinking for a long time ah ah ah, a day and a half of the evil matrix switch. ,。 ~~nn, DFAGDAJFHJK

See QQ Just remember today is my birthday don't dare to think it this year only sophomore is so Big O (︶^︶) o Alas

Happy birthday.

Section: qq5.0 Course Web-Slide menu




ANDROID:QQ Multi-Slide Menu implementation

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.