Home

Awesome

SlideMenuLayout

Introduction

An android slide menu that supports left and right swipes and slides with parallax.
一个支持左右滑动并带有视差滑动效果的安卓滑动菜单控件。(中文版入口)
Platform <img src="https://img.shields.io/badge/license-Apache 2.0-green.svg?style=flat"> SDK

Demo

Encapsulate the sliding nesting of different scenarios.
<img src="/gif/demo2.gif" width="280px"/>

Features

Version

nameSlideMenuLayout
latestDownload

Configure

Maven

<dependency>
  <groupId>com.justkiddingbaby</groupId>
  <artifactId>slidemenu</artifactId>
  <version>the latest version</version>
  <type>pom</type>
</dependency>

JCenter

First. add to project build.gradle

repositories {
    jcenter()
}

Second. add to module build.gradle

compile 'com.justkiddingbaby:slidemenu:the latest version'

Attributes instruction

attributeinstructionvalue
slideModesliding modeleft right both none
slidePaddingthe content view padding when slide menu is openeddimension
slideTimethe time of slide menu open,the default value is 800msinteger
parallaxoption to toggle the parallax effect,default is trueboolean
contentAlphathe alpha of shadow for ContentView when menu is opened.(0<alpha<=1.0),default is 0.5ffloat
contentShadowColorthe color of shadow for ContentView when menu is sliding,default is #000000color
contentToggleoption to click on content view to close menu when it's opening,default is falseboolean
allowDraggingoption to enables or disables dragging for this viewboolean

Function instruction

returnfunction nameinstruction
voidsetSlideMode(int slideMode)set slide mode
voidsetSlidePadding(int slidePadding)set slide content padding when slide menu is open
voidsetSlideTime(int slideTime)set the time of opening slide menu
ViewgetSlideLeftView()return left slide menu view
ViewgetSlideRightView()return right slide menu view
ViewgetSlideContentView()return content view
voidtoggleLeftSlide()open or close left slide menu
voidopenLeftSlide()open left slide menu
voidcloseLeftSlide()close left slide menu
booleanisLeftSlideOpen()return the result of left slide menu is open
voidtoggleRightSlide()open or close right slide menu
voidopenRightSlide()open right slide menu
voidcloseRightSlide()close right slide menu
booleanisRightSlideOpen()return the result of right slide menu is open
voidsetParallaxSwitch(boolean parallax)set is able to toggle the parallax effect
voidsetContentAlpha(float contentAlpha)set the alpha of shadow for ContentView when menu is opened.,1.0f means the effect is not abled
voidsetContentShadowColor(int color)set the color of shadow for ContentView when menu is sliding,default is #000000
voidsetContentToggle(boolean contentToggle)option to click on content view to close menu when it's opening.default is false
voidsetAllowTogging(boolean allowTogging)set the option for whether to allow drag slidemenu to open/close slide menu.default is true.
voidaddOnSlideChangedListener(OnSlideChangedListener listener)Register a callback to be invoked when this slide is changed.

Usage

use in the layout

 <com.jkb.slidemenu.SlideMenuLayout
        android:id="@+id/mainSlideMenu"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/white"
        app:slideMode="both">
        <include layout="@layout/content_menu_left" />
        <include layout="@layout/content_menu_right" />
        <include layout="@layout/content_menu_content" />
 </com.jkb.slidemenu.SlideMenuLayout>

Mind

when you use SlideMenuLayout in layout,it can only host three child view,and the left slide menu view and the right slide menu view must add before the content view (for prevent the right slide menu from overlapping).
if slideMode is both then the SlideViewLayout must host three child views.

Release history

v1.3.0(2017/12/25)

1、Add feature: Enables or disables dragging for this view.
2、Add feature: Add listener to register a callback to be invoked when this slide is changed.

v1.2.2(2017/12/18)

1、Fix issue#5

v1.2.1(2017/9/18)

1、Intercept the touch action of content view when contentToggle attribute's value is true.

v1.2.0(2017/8/20)

1、Add feature: Option to click on content view to close menu when it's opening. 2、Add feature: Option to dim the content view automatically. 3、Add feature: Option to toggle the parallax effect.

v1.0.1(2017/6/29)

1、Update minSdkVersion to SDK 12.

v1.0.0(2017/6/8)

1、Release SlideMenuLayout,Handle the sliding conflicts in each scenarios.
2、Encapsulation demo.

License

This library is available under the MIT license. See the LICENSE file for more info.