Home

Awesome

SlideLayout

SlideLayout is an Open Source Android library that allows developers to easily add SlideMenu feature. It supports 4 menu at each side of content view concurrently.

A demo app can be found on [Google PlayStore] (https://play.google.com/store/apps/details?id=com.rey.slidelayoutdemo)

![] (https://farm4.staticflickr.com/3761/13168480255_e216f067b5.jpg)![] (https://farm8.staticflickr.com/7107/13168733084_075e178019.jpg)
![] (https://farm8.staticflickr.com/7177/13168469925_7397000a02.jpg)![] (https://farm4.staticflickr.com/3759/13168558143_a95f0d3d31.jpg)

I would appreciate any kind of help to improve this library. Thanks

Usage

####Usage in XML

You must declare SlideLayoutStyle in styles.xml:

    <style name="SlideLayoutStyleDemo" parent="@style/SlideLayoutStyleDefault">
        <item name="sl_dragEnable">true</item>
        <item name="sl_leftMenuStyle">@style/LeftSlideMenuStyleDemo</item>        
        <item name="sl_rightMenuStyle">@style/RightSlideMenuStyleDemo</item>  
        <item name="sl_topMenuStyle">@style/TopSlideMenuStyleDemo</item>
        <item name="sl_bottomMenuStyle">@style/BottomSlideMenuStyleDemo</item>
        <item name="sl_menuStyle">@style/SlideMenuStyleDemo</item>
    </style>

######Attributes

    public void openLeftMenu(boolean animation);
    
    public void openRightMenu(boolean animation);

    public void openTopMenu(boolean animation);
    
    public void openBottomMenu(boolean animation);

and some SlideMenuStyle:

    <style name="SlideMenuStyleDemo" parent="@style/SlideMenuStyleDefault">
        <item name="sm_overDrag">false</item>
        <item name="sm_menuBorder">48dp</item>
        <item name="sm_menuOverDragBorder">0dp</item>
        <item name="sm_slideRatio">0.5</item>
        <item name="sm_menuShadow">8dp</item>
        <item name="sm_dragEdge">48dp</item>
        <item name="sm_touchSlop">16dp</item>
        <item name="sm_maxDim">0.7</item>
        <item name="sm_velocitySlop">500</item>
        <item name="sm_animDuration">800</item>
        <item name="sm_closeEdge">0.75</item>
        <item name="sm_animInterpolator">@android:anim/decelerate_interpolator</item>
    </style>

######Attributes

Declare the following view on your xml layout:

    <com.rey.slidelayout.SlideLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        style="@style/SlideLayoutStyleDemo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:sl_contentChild="4"
        app:sl_leftMenuChild="0"
        app:sl_rightMenuChild="1"
        app:sl_topMenuChild="2"
        app:sl_bottomMenuChild="3">
        
        <TextView 
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Left Menu"/>
        
        <TextView 
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Right Menu"/>
        
        <TextView 
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Top Menu"/>
        
        <TextView 
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Bottom Menu"/>
        
        <TextView 
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Content View"/>
        
    </com.rey.slidelayout.SlideLayout>

######Attributes

The order of menu and content view in SlideLayout decides menu will be above (Google style) or below (Facebook style) content view.

####Usage in Code

Declare SlideLayoutStyle in styles.xml:

    <style name="SlideLayoutStyleDemo" parent="@style/SlideLayoutStyleDefault">
        <item name="sl_dragEnable">true</item>
        <item name="sl_leftMenuStyle">@style/LeftSlideMenuStyleDemo</item>        
        <item name="sl_rightMenuStyle">@style/RightSlideMenuStyleDemo</item>  
        <item name="sl_topMenuStyle">@style/TopSlideMenuStyleDemo</item>
        <item name="sl_bottomMenuStyle">@style/BottomSlideMenuStyleDemo</item>
        <item name="sl_menuStyle">@style/SlideMenuStyleDemo</item>
        <item name="sl_contentChild">4</item>
        <item name="sl_leftMenuChild">0</item>
        <item name="sl_rightMenuChild">1</item>
        <item name="sl_topMenuChild">2</item>
        <item name="sl_bottomMenuChild">3</item>
    </style>

Use the following code:

    SlideLayout sl = new SlideLayout(context, null, R.style.SlideLayoutStyleDemo);
	sl.addView(leftMenuView);
	sl.addView(rightMenuView);
	sl.addView(topMenuView);
	sl.addView(bottomMenuView);
	sl.addView(contentView);

Note that you have to add view to SlideLayout in correct order specificed in style. If you want to attach SlideLayout to activity, use the followed function instead of addView(contentView)

    public void attachToActivity(Activity activity, boolean attachToWindow);

Developed By

Credits

Contributing

Want to contribute? You are welcome!