Recommended Today (iii) Androidresidemenu similar to QQ side-effect

Source: Internet
Author: User

DEMO

This code is demo, you can download and choose your favorite IDE to run. The SDK version recommends using more than 4.0

Version Migration from v1.0 , v1.1 , v1.2 , v1.3 upgrading to v1.4

If you start the gesture swipe, you need to replace the attached Activity dispatchTouchEvent() code

@Override
public boolean dispatchtouchevent (Motionevent ev) {
return residemenu.dispatchtouchevent (EV); }

Requirements

Run on Android 2.3 +

installationGradle
repositories {    mavencentral ()}
dependencies { compile ' com.specyci:residemenu:1.6+ '

}
Other

Import Residemenu projects directly and as dependent projects
Example

or merge directly into your project

    1. Copy all the code under Src/com/special/residemenu to the appropriate location in your project

    2. Copy Libs/nineoldandroids-library-2.4.0.jar to your project libs/

    3. Copy Res/drawable-hdpi/shadow.9.png to the appropriate location for your project

    4. copy res/layout/residemenu.xml and RESIDEMENU_ITEM.XML to the appropriate location for your project

Usage

Written in activity onCreate ()

Attach to current activity; Residemenu =New Residemenu (this);
Residemenu.setbackground (R.drawable.menu_background); Residemenu.attachtoactivity (this);
Create menu items; String titles[] = {"Home", "Profile", "Calendar", "Settings"};
int icon[] = {
R.drawable.icon_home,
R.drawable.icon_profile,
R.drawable.icon_calendar,
R.drawable.icon_settings
};

for (int i = 0; i < titles.length; i++) {Residemenuitem item = new Residemenuitem (this, icon[i], titles[i]);Item.setonclicklistener (this);Residemenu.addmenuitem (item, residemenu.direction_left);
or Residemenu.direction_right}

If you need to swipe the on/off menu using gestures, make a copy of the activity's dispatchtouchevent (), the code below

@Override         Public Boolean dispatchtouchevent (motionevent ev) {                return  residemenu.dispatchtouchevent (EV);         }

In some scenarios, the gesture swipe on/off menu may conflict with some of your controls, such as Viewpager, when you can add Viewpager to ignored view. See the next section ignored views

Open or Close menu

// or Residemenu.direction_rightresidemenu.closemenu ();

Listening for menu status

Residemenu.setmenulistener (Menulistener); PrivateResidemenu.onmenulistener Menulistener =NewResidemenu.onmenulistener () {@Override Public voidOpenmenu () {Toast.maketext (Mcontext,"Menu is opened!", Toast.length_short). Show (); } @Override Public voidClosemenu () {Toast.maketext (Mcontext,"Menu is closed!", Toast.length_short). Show (); }    };

Disable gesture manipulation of a menu direction

Residemenu.setswipedirectiondisable (Residemenu.direction_right);

Ignored views

In some scenarios, the gesture swipe on/off menu may conflict with some of your controls, such as Viewpager, when you can add Viewpager to ignored view.

// add gesture operation ' s ignored views Framelayout Ignored_view = (framelayout) Findviewbyid (R.ID. ignored_view); Residemenu.addignoredview ( Ignored_view);

This way, the ignored_view operation of the area is not allowed to swipe the action menu with gestures.

Source Download:

Https://github.com/SpecialCyCi/AndroidResideMenu

Recommended Today (iii) Androidresidemenu similar to QQ side-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.