SlidingMenu README

The project's README from github.com/jfeinstein10/SlidingMenu. As one markdown file: README.md.

SlidingMenu (Play Store Demo)

SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus like those made popular in the Google+, YouTube, and Facebook apps. Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.

SlidingMenu is currently used in some awesome Android apps. Here's a list of some of them:

If you are using SlidingMenu in your app and would like to be listed here, please let me know via Twitter!

Here's an older video of the example application in this repository : http://youtu.be/8vNaANLHw-c

Also, you can follow the project on Twitter : @SlidingMenu

Setup

Setup with ActionBarSherlock

How to Integrate this Library into Your Projects

In order to integrate SlidingMenu into your own projects you can do one of two things.

1. You can wrap your Activities in a SlidingMenu by constructing it programmatically (new SlidingMenu(Context context)) and then calling SlidingMenu.attachToActivity(Activity activity, SlidingMenu.SLIDING_WINDOW | SlidingMenu.SLIDING_CONTENT). SLIDING_WINDOW will include the Title/ActionBar in the content section of the SlidingMenu, while SLIDING_CONTENT does not. You can check it out in the example app AttachExample Activity.

2. You can embed the SlidingMenu at the Activity level by making your Activity extend SlidingActivity.

3. You can use the SlidingMenu view directly in your xml layouts or programmatically in your Java code.

Simple Example

public class SlidingExample extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle(R.string.attach);
		// set the content view
		setContentView(R.layout.content);
		// configure the SlidingMenu
		SlidingMenu menu = new SlidingMenu(this);
        menu.setMode(SlidingMenu.LEFT);
		menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		menu.setShadowWidthRes(R.dimen.shadow_width);
		menu.setShadowDrawable(R.drawable.shadow);
		menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
		menu.setFadeDegree(0.35f);
		menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
		menu.setMenu(R.layout.menu);
	}
    
}

XML Usage

If you decide to use SlidingMenu as a view, you can define it in your xml layouts like this:

<com.jeremyfeinstein.slidingmenu.lib.SlidingMenu
    xmlns:sliding="http://schemas.android.com/apk/res-auto"
    android:id="@+id/slidingmenulayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    sliding:viewAbove="@layout/YOUR_ABOVE_VIEW"
    sliding:viewBehind="@layout/YOUR_BEHIND_BEHIND"
    sliding:touchModeAbove="margin|fullscreen"
    sliding:behindOffset="@dimen/YOUR_OFFSET"
    sliding:behindWidth="@dimen/YOUR_WIDTH"
    sliding:behindScrollScale="@dimen/YOUR_SCALE"
    sliding:shadowDrawable="@drawable/YOUR_SHADOW"
    sliding:shadowWidth="@dimen/YOUR_SHADOW_WIDTH"
    sliding:fadeEnabled="true|false"
    sliding:fadeDegree="float"
    sliding:selectorEnabled="true|false"
    sliding:selectorDrawable="@drawable/YOUR_SELECTOR"/>

NOTE : you cannot use both behindOffset and behindWidth. You will get an exception if you try.

Caveats

Developed By

License

Copyright 2012-2014 Jeremy Feinstein

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.

SlidingMenu (jfeinstein10/SlidingMenu)

Searching Database…

What is this?An open source Android library for slide-in navigation menus, the pattern made popular by the Google+, YouTube, and Facebook apps. You embed it in your own Android app.
What am I looking at when the menu opens?The screen splits into an above view (your content) and a behind view (the menu). Opening the menu slides the above view aside to reveal the behind view, which you set with setBehindContentView or viewBehind.
How do I add it to my Android project?In Eclipse, import SlidingMenu as an Android library project, run Project > Clean to generate resources like R.java, then add it as a dependency to your existing project.
Does it work with ActionBarSherlock?Yes. Add ActionBarSherlock as a dependency to SlidingMenu, then make the SlidingActivities you use extend the Sherlock activities instead of the regular ones.
Any gotchas I should know about upfront?You cannot set both behindOffset and behindWidth; trying throws an exception. Your layouts also have to be based on a viewgroup, which the README admits negates some optimizations.
Is it actually proven, or a hobby experiment?Proven at scale: the README lists Foursquare, LinkedIn, Rdio, Evernote Food, VLC for Android, 9GAG, Wunderlist 2, and The Verge among apps using it.
Can I ship it in my own app, and is attribution required?Yes. It is Apache 2.0 and free to use, but the author asks one thing in return: cite the project and include the license in your app.
What is the difference between SLIDINGWINDOW and SLIDINGCONTENT?They are the two attachToActivity modes: SLIDINGWINDOW includes the Title/ActionBar in the sliding content section, while SLIDINGCONTENT leaves it out.
What does touchModeAbove change?Which part of the screen is touchable while the above view shows: 'margin' means only the left margin opens the menu, 'fullscreen' means the entire screen. Margin is the default.
Will the selector highlight work with ListView items?Probably not. You must call setSelectedView with the chosen view, and the README warns it will most likely not work with items in a ListView because of how Android recycles item views.
Size
31.3 MB
Stars
11K
Updated
CommitMar 09
Age
14y
Commits · 90 Days