Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/desnyki/InfinityMenu

Android library to create a sleek menu
https://github.com/desnyki/InfinityMenu

Last synced: 1 day ago
JSON representation

Android library to create a sleek menu

Lists

README

        

# InfinityMenu

[![GitHub license](https://img.shields.io/github/license/dcendents/android-maven-gradle-plugin.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![](https://jitpack.io/v/desnyki/InfinityMenu.svg)](https://jitpack.io/#desnyki/InfinityMenu)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Infinity%20Menu-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/4510)

InfinityMenu is an Android Library implementing an accordion style menu. You can place any view with any size in the menu. To close the menu you can drag to close or tap outside the menu. You can have only one menu open at a time.

Add it to your build.gradle with:
```gradle
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
```
and:

```gradle
dependencies {
compile 'com.github.desnyki:InfinityMenu:1.0.3'
}
```

![Demo][1]

Android app on Google Play

How to use:

You can look at the sample app to see how to use this library in detail.

In your layout create a FrameLayout which will hold the RootScrollView that contains the menu title bars. As well as the ChildScrollView that holds the menu item. It is important to set fillViewport for RootScrollView, and to set ChildScrollView as invisible.

```xml






```

You can style and place menu title bars as children of the RootScrollView. If you want to animate the arrow like in the gif, you will need to have an element with tag "arrow" which will then spin 90 degrees based on state.

``` xml

```
In your main Activity you will have to get a reference to both the ChildScrollView and RootScrollView as well as the bar views.

```java
childScrollView.setBackgroundScrollView(rootScrollView);
childScrollView.setCloseDistance(50);

RelativeLayout bar1 = (RelativeLayout) findViewById(R.id.bar1);
bar1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
childScrollView.addView((LinearLayout) getLayoutInflater().inflate(R.layout.my_menu_item, null), 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
childScrollView.openWithAnim(bar1,true,false);
}
});
```

.openWithAnim(param 1: title bar object, param 2: is child full screen, param 3: do you want to show the title bar if full screen) is the call that opens your accordion.

License
-------

Copyright 2016 Marcin Deszczynski

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.

[1]: ./art/demo.gif