Giter Club home page Giter Club logo

sliding-menu's Introduction

Dead simple sliding menu

An Android library that extends FragmentActivity to create a menu that slides out from the left hand side of the activity.

Overview

While it's called SlidingMenu, it can really hold any 2 layouts or fragments. It's pretty easy to implement and has relatively few options at the moment, check the SlidingMenuTest project to see an implementation.

First, you make your Activity extend SlidingMenuActivity like so:

public class SomeActivity extends SlidingMenuActivity {

Then, the only absolutely required function is to call

setLayoutIds(int menuLayoutId, int contentLayoutId)

in your activity's OnCreate before the call to

super.OnCreate()

then do everything else like normal.

You can wire up the toggle to any click/touch/etc event by calling

toggleMenu();

Details

Constructors

SlidingMenuActivity()

Is the default constructor, this initializes the activity with a sliding title bar (actionbar) If you want to pick if the title bar (actionbar) slides or not call:

SlidingMenuActivity(bool slideTitleBar)

If you want the titlebar (actionbar) to disapper, call requestWindowFeature(Window.FEATURE_NO_TITLE); in your onCreate().

Functions

setAnimationDuration(long duration)  

Sets how long in milliseconds the opening/closing animation will run.

setMaxMenuWidth(int width)  

Sets the max width (in dips) of the menu. The main content will stop sliding at this many dips from the left side of the screen (unless it would make the content slide farther than the minContentWidth below.

setMinContentWidth(int width)  

Sets the minimum amount the content window can leave on the screen. The main content will stop sliding at this many dips from the right side of the screen.

setAnimationType(int type)  

Sets the type of animation used. Currently there are 3 types:
MENU_TYPE_SLIDING
which slides the menu out from the left, pushing the main content over and
MENU_TYPE_SLIDEOVER
which is the default, where the content slides away exposing the menu underneath. And finally, the experimental MENU_TYPE_PARALLAX which sounds all fancy, but just means that the menu and content slide at different speeds.

setInterpolator(Interpolator i)  

Sets the interpolator used by the animation. The default is a DecelerateInterpolator which makes the animation start fast and end slow.

License

Copyright (c) 2013 Matt Munday

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sliding-menu's People

Contributors

munday avatar

Watchers

Dilmurat Abdulqayyum avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.