:
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
Copy all the code under Src/com/special/residemenu to the appropriate location in your project
Copy Libs/nineoldandroids-library-2.4.0.jar to your project libs/
Copy Res/drawable-hdpi/shadow.9.png to the appropriate location for your project
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