Description
A library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet.
SlidingUpMenu alternatives and similar packages
Based on the "Menu Widget" category.
Alternatively, view SlidingUpMenu alternatives based on common mentions on social networks and blogs.
-
SlidingMenu
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! -
android-menudrawer
*DEPRECATED* A slide-out menu implementation, which allows users to navigate between views in your app. -
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. -
BottomSheet
One way to present a set of actions to a user is with bottom sheets, a sheet of paper that slides up from the bottom edge of the screen. Bottom sheets offer flexibility in the display of clear and simple actions that do not need explanation. -
Material-BottomNavigation
Bottom Navigation widget component inspired by the Google Material Design Guidelines at https://www.google.com/design/spec/components/bottom-navigation.html -
ActionsContentView
DISCONTINUED. ActionsContentView is an standalone library implements actions/content swiping view (AKA Side Navigation UI Pattern, AKA Facebook side menu). The library doesn't use any specific code introduced in new Android SDK versions. This allows develop an application with an action/content swiping view for every version of Android from 2.2 and up. -
SideNavigation
Implementation of "Side Navigation" or "Fly-in app menu" pattern for Android (based on Google+ app) -
simple-side-drawer
Simple library which enable you to add a drawer(slide-out) navigation to your android application -
android-floating-action-menu
Floating Action Menu for Android. Inspired by the Google Plus floating menu -
Android-NewPopupMenu
Android-NewPopupMenu is an android library to create popup menu with GoogleMusic app-like style. -
Metaball-Menu
A menu consisting of icons (ImageViews) and metaball bouncing selection to give a blob effect. Inspired by Material design -
AndroidPullMenu
An Android Library that allows users to pull down a menu and select different actions. It can be implemented inside ScrollView, GridView, ListView.
InfluxDB - Purpose built for real-time analytics at any scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SlidingUpMenu or a related project?
README
SlidingUpMenu
A library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet.
Gradle Dependency
Add the dependency to your app's build.gradle
:
implementation 'com.r4sh33d:SlidingUpMenu:0.0.2'
Usage
It is very easy to get started with SlidingUpMenu
. Just specify a Context
and a menu resource file:
SlidingUpMenu(context, R.menu.sample_menu).show()
Title
You can specify the title for the menu dialog by supplying a String
id to the titleText
method.
SlidingUpMenu(context, R.menu.sample_menu).show {
titleText(R.string.basic_title)
}
You can also specify a String
for the title:
titleText(titleText = "Basic Title")
Menu Items
You specify the menu items by supplying a Menu
resource id and/or list of MenuModel
items. If both menu resource id and list of MenuModel is specified, SlidingUpMenu
will merge the sources together and present the menu items to users at once:
SlidingUpMenu(context, R.menu.sample_menu).show() // Menu resource id only
//or
SlidingUpMenu(context, menuModelItems = menuItems).show() // List of MenuModel only
//or
SlidingUpMenu(context, R.menu.sample_menu, menuItems).show() // Menu resource + List of MenuModel
Callback
To receive item selected events, You specify a MenuModelSelectedListener
to the menuModelSelected
method. The menuModelSelected
method takes in a lambda that will be called with the selected MenuModel
, the position of the MenuModel
and the SlidingUpMenu
instance.
SlidingUpMenu(context, R.menu.sample_menu).show {
titleText(R.string.basic_title)
menuModelSelected { slidingUpMenu, menuModel, position ->
//
}
}
You can identify the selected menu item by querying the menuModel.id
or using position
. For menu resource files inflated from xml, the id
is the android:id
specified in the menu item tag:
SlidingUpMenu(context, R.menu.sample_menu).show {
titleText(titleText = "Basic Title")
menuModelSelected { slidingUpMenu, menuModel, position ->
when (menuModel.id) {
R.id.menu_one -> TODO()
R.id.menu_two -> TODO()
R.id.menu_three -> TODO()
//...
}
}
}
Showing and Dismissing Menu
Showing Menu
You can create and immediately show the dialog, as seen the sample code snippets above. Just call the show() method variant that takes in a configuration block. You can add configurations in the block. SlidingUpMenu
will apply the configuration and show the dialog immediately:
SlidingUpMenu(context, R.menu.sample_menu).show {
// Configuration block
titleText(R.string.basic_title)
icon(R.drawable.icon)
menuType(GRID)
// ...
}
Alternatively, you can create and configure the SlidingUpMenu
instance, and show at a later time:
val slidingUpMenu = SlidingUpMenu(context, R.menu.sample_menu)
// perform some operations
slidingUpMenu.titleText(R.string.basic_title)
.icon(R.drawable.icon)
.menuType(GRID)
//...
// Then after some time.
slidingUpMenu.show()
Dismissing Menu
By default, SlidingMenu
will automatically be dismissed anytime a menu item is selected. You can control this behaviour:
SlidingUpMenu(context, R.menu.sample_menu).show {
dismissOnMenuItemSelected(false)
}
If you disable auto-dismiss, you need to manually dismiss the menu dialog.
slidingUpMenu.dismiss()
Like other Dialog
s you can also configure the behaviour when users' touch outside the dialog content:
slidingUpMenu.setCanceledOnTouchOutside(true)
Menu Type
You can pass a MenuType
to the menuType
method to specify if you want the menu items to be arranged in a list or grid manner.
GRID
SlidingUpMenu(context, R.menu.sample_menu).show {
menuType(MenuType.GRID)
}
LIST
SlidingUpMenu(context, R.menu.sample_menu).show {
menuType(MenuType.LIST)
}
Scroll Direction
To control the scrolling direction for the menu items, You specify a ScrollDirection
to the scrollDirection
method:
SlidingUpMenu(context, R.menu.sample_menu).show {
scrollDirection(ScrollDirection.HORIZONTAL)
//or
scrollDirection(ScrollDirection.VERTICAL)
}
Icon
To set an icon for the menu dialog, use the icon
method to supply a Drawable
or a drawable resource id. The icon will be displayed at the top left corner of the menu dialog.
SlidingUpMenu(context, R.menu.sample_menu).show {
icon(R.drawable.icon)
// or
val drawable = {...}
icon(drawable)
}
Theming
Corner Radius
You can get rounded edges by specifying a corner radius to the menu dialog:
SlidingUpMenu(context, R.menu.sample_menu).show {
cornerRadius(16f) // 16dp
// or
cornerRadius(R.dimen.cornerRadius) // from dimens resource
}
You can also specify the corner radius as an attribute in your theme style definition.
<style name="AppThemeLight" parent="Theme.MaterialComponents.Light.DarkActionBar">
...
<item name="sm_corner_radius">24dp</item>
...
</style>
Corner Radius
Text Color and Font
You can specify colors and fonts for dialog title and body with theme attributes:
<style name="AppThemeLight" parent="Theme.MaterialComponents.Light.DarkActionBar">
...
<item name="sm_title_text_font">@font/fugaz_one</item>
<item name="sm_title_text_color">@color/colorAccent</item>
<item name="sm_body_text_font">@font/maven_pro</item>
<item name="sm_body_text_color">@android:color/holo_orange_light</item>
...
</style>
Background color
You can set background color for menu dialog:
<style name="AppThemeLight" parent="Theme.MaterialComponents.Light.DarkActionBar">
...
<item name="sm_background_color">@color/menuBackground</item>
...
</style>
Ripple color
You can set the color for to use as background when menu items are selected:
<style name="AppThemeLight" parent="Theme.MaterialComponents.Light.DarkActionBar">
...
<item name="sm_ripple_color">@color/rippleColor</item>
...
</style>
SlidingUpMenu
uses Dialog under the hood, so most standard Dialog
operations should also be available.
You can also check out MaterialDialogs for more customizable set of Dialogs. The icons used in the screenshots are from here.
License
Copyright (c) 2019 Rasheed Sulayman.
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.
*Note that all licence references and agreements mentioned in the SlidingUpMenu README section above
are relevant to that project's source code only.