Giter Site home page Giter Site logo

coolmenu's Introduction

coolMenu

The Android implementation of Cards Menu Concept by Gal Shir.

This is Gal Shir's awesome shot.

Usage

I published the library with Jitpack, so add it to your build.gradle with:

repositories {
    ...
    maven { url "https://jitpack.io" }
}

Add the dependency:

dependencies {
	compile 'com.github.DxTT:coolMenu:v1.1'
}

The usage is really like ViewPager, just add CoolMenuFrameLayout to your layout.

An example of basic usage in layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.foocoder.coolmenu.MainActivity"
    tools:ignore="all"
    tools:showIn="@layout/activity_main">

    <com.dxtt.coolmenu.CoolMenuFrameLayout
        android:id="@+id/rl_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        app:num="four"/>
</merge>

This statement declares the number of cards, The upper limit is five.

app:num="four"

You can set your title icon or title style in xml like this:

app:titleSize="@dimen/cl_title_size"
app:titleColor="@color/colorPrimary"
app:titleIcon="@drawable/menu"

Like ViewPager,set an Adapter for the CoolMenuFrameLayout view.

coolMenuFrameLayout = $(R.id.rl_main);
String[] titles = {"CONTACT", "ABOUT", "TEAM", "PROJECTS"};
titleList = Arrays.asList(titles);
//set your titles,which is optional
coolMenuFrameLayout.setTitles(titleList);
//set your menu icon
coolMenuFrameLayout.setMenuIcon(R.drawable.menu2);

fragments.add(new Fragment1());
fragments.add(new Fragment2());
fragments.add(new Fragment3());
fragments.add(new Fragment4());

FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
		return fragments.size();
    }
};
coolMenuFrameLayout.setAdapter(adapter);

Contributors

@xuechister,@foocoder

License

coolMenu is available under the MIT license

coolmenu's People

Contributors

notice501 avatar

Watchers

James Cloos 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.