AndroidResideMenu
The idea of ResideMenu is from Dribbble 1 and 2. It has come true and run in iOS devices. iOS ResideMenu This project is the RefsideMenu Android version. The visual effect is partly referred to iOS version of ResideMenu. And thanks to the authors for the above idea and contribution.
Top Related Projects
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Side menu with some categories to choose.
swipe display drawer with flowing & bouncing effects.
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Another sliding menu base on DrawerLayout
Quick Overview
AndroidResideMenu is a custom Android UI control that implements a sliding menu similar to the one found in the Facebook app. It provides a smooth and visually appealing way to reveal a hidden menu by swiping from the edge of the screen or tapping a menu button.
Pros
- Easy to integrate into existing Android projects
- Customizable appearance and behavior
- Smooth animations and gestures
- Supports both left and right side menus
Cons
- Last updated in 2017, potentially outdated for modern Android development
- Limited documentation and examples
- May not follow the latest Material Design guidelines
- Potential performance issues on older devices
Code Examples
- Initializing the ResideMenu:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.attachToActivity(this);
- Adding menu items:
ResideMenuItem itemHome = new ResideMenuItem(this, R.drawable.icon_home, "Home");
ResideMenuItem itemProfile = new ResideMenuItem(this, R.drawable.icon_profile, "Profile");
resideMenu.addMenuItem(itemHome, ResideMenu.DIRECTION_LEFT);
resideMenu.addMenuItem(itemProfile, ResideMenu.DIRECTION_LEFT);
- Handling menu item clicks:
itemHome.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Handle home item click
}
});
- Customizing the menu appearance:
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.setScaleValue(0.6f);
Getting Started
To use AndroidResideMenu in your project:
-
Add the dependency to your
build.gradle
file:dependencies { implementation 'com.specyci:residemenu:1.6' }
-
Initialize the ResideMenu in your activity:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ResideMenu resideMenu = new ResideMenu(this); resideMenu.attachToActivity(this); // Add menu items and customize as needed }
-
Implement click listeners for menu items and handle navigation accordingly.
Competitor Comparisons
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
Pros of SlidingMenu
- More mature and widely adopted project with a larger community
- Supports both left and right sliding menus
- Offers more customization options and features
Cons of SlidingMenu
- No longer actively maintained (last commit in 2016)
- Heavier implementation compared to AndroidResideMenu
- May require more setup and configuration
Code Comparison
AndroidResideMenu:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
SlidingMenu:
SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
Both libraries offer simple implementation, but SlidingMenu provides more configuration options out of the box. AndroidResideMenu focuses on a specific style of menu, while SlidingMenu is more flexible in terms of customization.
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Pros of MaterialDrawer
- More comprehensive and feature-rich, offering a wide range of customization options
- Actively maintained with frequent updates and improvements
- Better integration with Material Design principles and components
Cons of MaterialDrawer
- Steeper learning curve due to its extensive feature set
- Potentially larger app size and increased complexity for simple use cases
Code Comparison
AndroidResideMenu:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
MaterialDrawer:
new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.addDrawerItems(
new PrimaryDrawerItem().withName("Home"),
new SecondaryDrawerItem().withName("Settings")
)
.build();
Summary
MaterialDrawer offers a more comprehensive solution with better Material Design integration and active maintenance. However, it may be overkill for simple implementations. AndroidResideMenu provides a simpler approach but lacks advanced features and recent updates. The choice between the two depends on the project's specific requirements and complexity.
Side menu with some categories to choose.
Pros of Side-Menu.Android
- More visually appealing with smooth animations and customizable design
- Actively maintained with recent updates and contributions
- Comprehensive documentation and example usage provided
Cons of Side-Menu.Android
- Slightly more complex implementation compared to AndroidResideMenu
- May require more system resources due to advanced animations
Code Comparison
Side-Menu.Android:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.addMenuItem(menuItem, ResideMenu.DIRECTION_LEFT);
AndroidResideMenu:
mResideMenu = new ResideMenu(this);
mResideMenu.setBackground(R.drawable.menu_background);
mResideMenu.attachToActivity(this);
mResideMenu.addMenuItem(menuItem, ResideMenu.DIRECTION_LEFT);
Both libraries offer similar basic functionality for implementing a side menu. However, Side-Menu.Android provides more advanced customization options and animations, while AndroidResideMenu focuses on simplicity and ease of use.
Side-Menu.Android is better suited for projects requiring a polished, modern look with smooth transitions. AndroidResideMenu is ideal for simpler implementations or projects with limited resources.
When choosing between the two, consider your project's specific requirements, design preferences, and performance constraints.
swipe display drawer with flowing & bouncing effects.
Pros of FlowingDrawer
- More fluid and visually appealing animations
- Supports both left and right drawer layouts
- Customizable menu content with flexible layout options
Cons of FlowingDrawer
- Less actively maintained (last update in 2017)
- Fewer stars and forks on GitHub, indicating potentially less community support
- Limited documentation and examples compared to AndroidResideMenu
Code Comparison
AndroidResideMenu:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.addMenuItem(menuItem, ResideMenu.DIRECTION_LEFT);
FlowingDrawer:
mDrawer = (FlowingDrawer) findViewById(R.id.drawerlayout);
mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
mDrawer.setOnDrawerStateChangeListener(new ElasticDrawer.OnDrawerStateChangeListener() {
@Override
public void onDrawerStateChange(int oldState, int newState) {
// Handle state changes
}
});
Both libraries offer easy-to-use APIs for implementing sliding menus in Android applications. AndroidResideMenu provides a simpler setup process and more extensive documentation, while FlowingDrawer offers more visually appealing animations and flexible layout options. The choice between the two depends on the specific requirements of your project and the desired visual aesthetics.
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Pros of SlidingRootNav
- More customizable and flexible, allowing for various drawer layouts and animations
- Supports both left and right drawer positions
- Actively maintained with recent updates and bug fixes
Cons of SlidingRootNav
- Slightly more complex implementation due to increased customization options
- May require more setup time for basic functionality compared to AndroidResideMenu
Code Comparison
AndroidResideMenu:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.addMenuItem(menuItem, ResideMenu.DIRECTION_LEFT);
SlidingRootNav:
new SlidingRootNavBuilder(this)
.withMenuLayout(R.layout.menu_left_drawer)
.withDragDistance(140)
.withRootViewScale(0.7f)
.withMenuOpened(false)
.inject();
Both libraries offer easy-to-use APIs for implementing sliding menus in Android applications. AndroidResideMenu provides a simpler setup process with fewer customization options, making it ideal for quick implementations. SlidingRootNav, on the other hand, offers more flexibility and control over the menu's appearance and behavior, but may require more initial configuration.
SlidingRootNav's active maintenance and support for both left and right drawer positions give it an edge for long-term projects. However, AndroidResideMenu's simplicity might be preferable for smaller applications or rapid prototyping.
Another sliding menu base on DrawerLayout
Pros of FantasySlide
- More customizable with support for various animations and transitions
- Allows for multiple sliding layers, creating a more complex and interactive UI
- Supports both left and right sliding menus simultaneously
Cons of FantasySlide
- Slightly more complex implementation due to increased customization options
- May require more resources due to additional features and animations
- Less established community and fewer examples compared to AndroidResideMenu
Code Comparison
AndroidResideMenu:
ResideMenu resideMenu = new ResideMenu(this);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(this);
resideMenu.addMenuItem(menuItem, ResideMenu.DIRECTION_LEFT);
FantasySlide:
SlidingLayout slidingLayout = new SlidingLayout(this);
slidingLayout.setBackground(R.drawable.menu_background);
slidingLayout.bindActivity(this);
slidingLayout.addLayer(new MenuLayer(), SlidingLayout.DIRECTION_LEFT);
slidingLayout.addLayer(new ContentLayer(), SlidingLayout.DIRECTION_RIGHT);
Both libraries offer similar functionality for creating sliding menus, but FantasySlide provides more flexibility with multiple layers and customization options. AndroidResideMenu has a simpler implementation, which may be preferable for basic sliding menu needs. The choice between the two depends on the specific requirements of your project and the level of complexity you're willing to work with.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
#AndroidResideMenu
ä¸æ说æ请ç¹å» è¿é
The idea of ResideMenu is from Dribble 1 and 2. It has come true and run in iOS devices. iOS ResideMenu This project is the RefsideMenu Android version. The visual effect is partly referred to iOS version of ResideMenu. And thanks to the authors for the above idea and contribution.
Now with 3D support !
DEMO
This copy is the demo.
Version Migration
Upgrading to v1.4
from v1.3
, v1.2
, v1.1
, v1.0
Duplicate the followed code in dispatchTouchEvent() of Activity, replace the old dispatchTouchEvent()
code.
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return resideMenu.dispatchTouchEvent(ev);
}
Requirements
Run in Android 2.3 +
Installation
Gradle
repositories {
mavenCentral()
}
dependencies {
compile 'com.specyci:residemenu:1.6+'
}
Other
- import ResideMenu project to your workspace.
- make it as a dependency library project to your main project.
( see example )
or
If you want to merge ResideMenu with your project, you should follow these steps.
- Copy all files from src/com/special/ResideMenu to your project.
- Copy libs/nineoldandroids-library-2.4.0.jar to your projectâs corresponding path: libs/
- Copy res/drawable-hdpi/shadow.9.png to your projectâs corresponding path: res/drawable-hdpi/
- Copy res/layout/residemenu.xml and residemenu_item.xml to your projectâs corresponding path: res/layout
Usage
init ResideMenu: write these code 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 want to use slipping gesture to operate(lock/unlock) the menu, override this code in Acitivity dispatchTouchEvent() (please duplicate the followed code in dispatchTouchEvent() of Activity.
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return resideMenu.dispatchTouchEvent(ev);
}
On some occasions, the slipping gesture function for locking/unlocking menu, may have conflicts with your widgets, such as viewpager. By then you can add the viewpager to ignored view, please refer to next chapter â Ignored Views.
open/close menu
resideMenu.openMenu(ResideMenu.DIRECTION_LEFT); // or ResideMenu.DIRECTION_RIGHT
resideMenu.closeMenu();
listen in the menu state
resideMenu.setMenuListener(menuListener);
private ResideMenu.OnMenuListener menuListener = new ResideMenu.OnMenuListener() {
@Override
public void openMenu() {
Toast.makeText(mContext, "Menu is opened!", Toast.LENGTH_SHORT).show();
}
@Override
public void closeMenu() {
Toast.makeText(mContext, "Menu is closed!", Toast.LENGTH_SHORT).show();
}
};
disable a swipe direction
resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT);
Custom Usage
Do your reside menu configurations, by creating an instance of ResideMenu with your custom layout's resource Ids. If you want to use default layout, just pass that variable as -1.
resideMenu = new ResideMenu(activity, R.layout.menu_left, R.layout.menu_right);
resideMenu.setBackground(R.drawable.menu_background);
resideMenu.attachToActivity(activity);
resideMenu.setScaleValue(0.5f);
resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_RIGHT);
resideMenu.setSwipeDirectionDisable(ResideMenu.DIRECTION_LEFT);
As your configuration's completed, now you can customize side menus by getting instances of them as following:
View leftMenu = resideMenu.getLeftMenuView();
// TODO: Do whatever you need to with leftMenu
View rightMenu = resideMenu.getRightMenuView();
// TODO: Do whatever you need to with rightMenu
##Ignored Views On some occasions, the slipping gesture function for locking/unlocking menu, may have conflicts with your widgets such as viewpager.By then you can add the viewpager to ignored view.
// add gesture operation's ignored views
FrameLayout ignored_view = (FrameLayout) findViewById(R.id.ignored_view);
resideMenu.addIgnoredView(ignored_view);
So that in ignored viewâs workplace, the slipping gesture will not be allowed to operate menu.
##About me
A student from SCAU China.
Email: specialcyci#gmail.com
Top Related Projects
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Side menu with some categories to choose.
swipe display drawer with flowing & bouncing effects.
DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Another sliding menu base on DrawerLayout
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot