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.
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.
You can easily add awesome animated context menu to your app.
Quick Overview
Yalantis/Side-Menu.Android is an open-source Android library that provides an animated side menu implementation. It offers a customizable and visually appealing navigation drawer with smooth animations, enhancing the user experience in Android applications.
Pros
- Beautiful and smooth animations for side menu transitions
- Highly customizable appearance and behavior
- Easy integration into existing Android projects
- Well-documented and maintained by Yalantis, a reputable mobile development company
Cons
- May require additional setup compared to the standard Android navigation drawer
- Animations might be resource-intensive on older devices
- Limited to side menu functionality, not a comprehensive UI framework
Code Examples
- Initializing the Side Menu:
val sideMenu = SideMenu(this)
sideMenu.setMenuView(R.layout.menu_layout)
sideMenu.attachToActivity(this)
- Opening and closing the Side Menu programmatically:
// Open the menu
sideMenu.openMenu()
// Close the menu
sideMenu.closeMenu()
- Customizing the animation:
sideMenu.setAnimationDuration(300) // Set animation duration in milliseconds
sideMenu.setScaleValue(0.6f) // Set the scale of the content view when menu is open
Getting Started
To use Yalantis/Side-Menu.Android in your project, follow these steps:
- Add the JitPack repository to your root build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency to your app's build.gradle file:
dependencies {
implementation 'com.github.Yalantis:Side-Menu.Android:1.0.2'
}
- Initialize the Side Menu in your activity:
class MainActivity : AppCompatActivity() {
private lateinit var sideMenu: SideMenu
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
sideMenu = SideMenu(this)
sideMenu.setMenuView(R.layout.menu_layout)
sideMenu.attachToActivity(this)
}
}
Now you can use the Side Menu in your Android application. Customize it further by exploring the library's documentation and available methods.
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 established project with a larger user base
- Supports both left and right sliding menus
- Offers more customization options and features
Cons of SlidingMenu
- No longer actively maintained (last commit in 2016)
- May not be compatible with newer Android versions and libraries
- Heavier implementation compared to Side-Menu.Android
Code Comparison
SlidingMenu implementation:
SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
Side-Menu.Android implementation:
val menuFragment = MenuFragment()
supportFragmentManager.beginTransaction()
.replace(R.id.menu_frame, menuFragment)
.commit()
Side-Menu.Android offers a simpler implementation with a more modern approach using Fragments. SlidingMenu provides more granular control over the menu behavior but requires more code to set up.
Both libraries achieve similar results, but Side-Menu.Android is more lightweight and better suited for newer Android projects. SlidingMenu offers more features but may require additional work to integrate with modern Android development practices.
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 bug fixes
- Extensive documentation and sample implementations
Cons of MaterialDrawer
- Steeper learning curve due to its extensive feature set
- Larger library size, which may impact app size and performance
Code Comparison
Side-Menu.Android:
mViewAnimator = new ViewAnimator<>(this, new ArrayList<Resourceble>(), mMenuDrawable, this);
mViewAnimator.showMenuContent();
MaterialDrawer:
drawer = DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.addDrawerItems(
PrimaryDrawerItem().withName("Home"),
SecondaryDrawerItem().withName("Settings")
)
.build()
Side-Menu.Android focuses on providing a simple, animated side menu with a clean interface. It's lightweight and easy to implement but offers limited customization options.
MaterialDrawer, on the other hand, provides a more robust solution with extensive customization options, including various drawer types, header designs, and item styles. It integrates well with Material Design principles and offers more flexibility in creating complex navigation structures.
While Side-Menu.Android may be suitable for projects requiring a basic side menu with minimal setup, MaterialDrawer is better suited for applications needing a feature-rich, highly customizable navigation drawer that adheres to Material Design guidelines.
swipe display drawer with flowing & bouncing effects.
Pros of FlowingDrawer
- More fluid and visually appealing animation
- Customizable menu content with flexible layout options
- Supports both left and right-side drawer positions
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 Side-Menu.Android
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);
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 side menus in Android applications. Side-Menu.Android provides a more traditional approach with extensive customization options, while FlowingDrawer focuses on creating a unique, fluid animation effect. The choice between the two depends on the specific design requirements and desired user experience for your app.
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 flexible and customizable, allowing for various drawer layouts and animations
- Supports both left and right drawer positions
- Easier integration with existing projects due to its non-intrusive nature
Cons of SlidingRootNav
- Less visually striking out-of-the-box compared to Side-Menu.Android's default animations
- Requires more manual setup for advanced features and custom animations
- Slightly larger library size
Code Comparison
Side-Menu.Android implementation:
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY);
mMenuDrawer.setContentView(R.layout.activity_main);
mMenuDrawer.setMenuView(R.layout.menu_drawer);
SlidingRootNav implementation:
new SlidingRootNavBuilder(this)
.withMenuLayout(R.layout.menu_drawer)
.inject();
Both libraries offer simple implementation, but SlidingRootNav provides a more builder-style approach, which can be more intuitive for some developers. Side-Menu.Android requires separate method calls for setting content and menu views, while SlidingRootNav combines these in a single builder chain.
SlidingRootNav offers more flexibility in terms of customization and integration with existing projects, making it suitable for a wider range of applications. However, Side-Menu.Android provides more visually appealing default animations, which may be preferable for projects seeking a quick and attractive implementation without extensive customization.
You can easily add awesome animated context menu to your app.
Pros of Context-Menu.Android
- Provides a circular context menu with smooth animations
- Offers more customization options for menu items
- Suitable for apps requiring quick access to multiple actions
Cons of Context-Menu.Android
- May not be as intuitive for users accustomed to traditional side menus
- Potentially less space-efficient for apps with many menu items
- Could be visually overwhelming in certain app designs
Code Comparison
Side-Menu.Android:
mViewHolder.menu.setOnClickListener {
mMenuDrawer.toggleMenu()
}
Context-Menu.Android:
mMenuDialogFragment = MenuDialogFragment.newInstance()
mMenuDialogFragment.show(supportFragmentManager, "MenuDialogFragment")
The Side-Menu.Android implementation uses a simple toggle method for the menu, while Context-Menu.Android requires creating and showing a dialog fragment.
Summary
Context-Menu.Android offers a unique circular menu design with smooth animations and customization options. It's ideal for apps needing quick access to multiple actions. However, it may be less intuitive and space-efficient compared to Side-Menu.Android. The implementation differs, with Context-Menu.Android using a dialog fragment approach, while Side-Menu.Android employs a simpler toggle method. Choose based on your app's specific design requirements and user experience goals.
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
Side Menu
Side menu with some categories to choose.
Check this project on dribbble.
Check this project on Behance.
God bless Ukraine!
Sample
Sample & .aar file Note
depends on Ozodrukh's animation util for CircularReveal animation for 2.3+ version
Using
First of all you have to upload animation submodule with git submodule update --init
command
Or you can add gradle dependency with command :
dependencies {
implementation 'com.github.yalantis:Side-Menu.Android:1.0.2'
}
.
and command:
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
implementation 'com.github.ozodrukh:CircularReveal:(latest-release)@aar'
}
To add gradle dependency you need to open build.gradle (in your app folder,not in a project folder) then copy and add the dependencies there in the dependencies block;
for CircularReveal module
After you have to create special overlay layout to show in behind current Circular Reveal
animated view.
And to add all items to menu you have to add all of them into LinearLayout
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<io.codetail.widget.RevealFrameLayout
android:id="@+id/conteiner_frame"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/content_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
</io.codetail.widget.RevealFrameLayout>
<ScrollView
android:id="@+id/scrollView"
android:scrollbarThumbVertical="@android:color/transparent"
android:layout_width="80dp"
android:layout_height="match_parent"
android:layout_gravity="start|bottom">
<LinearLayout
android:id="@+id/left_drawer"
android:orientation="vertical"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="@android:color/transparent">
<!-- Layout of Drawer -->
</LinearLayout>
</ScrollView>
</android.support.v4.widget.DrawerLayout>
ViewAnimator viewAnimator = new ViewAnimator<>(ActionBarActivity.this,
new ArrayList<Resourceble>(),
(LinearLayout) findViewById(R.id.left_drawer),
contentFragment, drawerLayout);
//to open menu you have to override ActionBarDrawerToggle method
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
if (slideOffset > 0.6 && viewAnimator.getLinearLayout().getChildCount() == 0)
viewAnimator.showMenuContent();
}
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
viewAnimator.getLinearLayout().removeAllViews();
viewAnimator.getLinearLayout().invalidate();
}
All menu items should implement Resourceble
interface to get menu item name and drawable res
And all fragments should implement ScreenShotable
to get screenshot of a fragment
You can customize icons that u place in the menu,or add mor items. Simply by changing the list you parse to view animator .For example:
private List<SlideMenuItem> list = new ArrayList<>(); \\ the list of menu items
SlideMenuItem menuItem0 = new SlideMenuItem(ContentFragment.CLOSE, R.drawable.icn_close);
list.add(menuItem0);
SlideMenuItem menuItem = new SlideMenuItem(ContentFragment.BUILDING, R.drawable.icn_1); \\first parameter is the id of menu item,the second is the icon resouce
list.add(menuItem);
SlideMenuItem menuItem2 = new SlideMenuItem(ContentFragment.BOOK, R.drawable.icn_2);
list.add(menuItem2);
viewAnimator = new ViewAnimator<>(this, list, contentFragment, drawerLayout, this);
Let us know!
Weâd be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation.
P.S. Weâre going to publish more awesomeness wrapped in code and a tutorial on how to make UI for Android (iOS) better than better. Stay tuned!
License
Copyright 2019, Yalantis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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.
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.
You can easily add awesome animated context menu to your app.
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