GithubHelp home page GithubHelp logo

toprightmenu's Introduction

TopRightMenu

Platform

类似手机QQ界面右上角的弹出菜单,使用recyclerviewpopupwindow封装了一下.

废话不多说,先看效果图:

Gif

image

图片中看起来比较卡顿,但真机运行是正常的.

APK

下载demo.apk体验.

Install

Gradle:

compile 'com.zaaach:toprightmenu:1.0'

or Maven:

<dependency>
  <groupId>com.zaaach</groupId>
  <artifactId>toprightmenu</artifactId>
  <version>1.0</version>
  <type>pom</type>
</dependency>

or 下载library手动导入.

Usage

mTopRightMenu = new TopRightMenu(MainActivity.this);

//添加菜单项
List<MenuItem> menuItems = new ArrayList<>();
menuItems.add(new MenuItem(R.mipmap.multichat, "发起多人聊天"));
menuItems.add(new MenuItem(R.mipmap.addmember, "加好友"));
menuItems.add(new MenuItem(R.mipmap.qr_scan, "扫一扫"));

mTopRightMenu
        .setHeight(480)     //默认高度480
        .setWidth(320)      //默认宽度wrap_content
        .showIcon(true)     //显示菜单图标,默认为true
        .dimBackground(true)        //背景变暗,默认为true
        .needAnimationStyle(true)   //显示动画,默认为true
        .setAnimationStyle(R.style.TRM_ANIM_STYLE)
        .addMenuList(menuItems)
        .addMenuItem(new MenuItem(R.mipmap.facetoface, "面对面快传"))
        .addMenuItem(new MenuItem(R.mipmap.pay, "付款"))
        .setOnMenuItemClickListener(new TopRightMenu.OnMenuItemClickListener() {
              @Override
              public void onMenuItemClick(int position) {
                  Toast.makeText(MainActivity.this, "点击菜单:" + position, Toast.LENGTH_SHORT).show();
              }
        })
        .showAsDropDown(moreBtn, -225, 0);	//带偏移量
//      		.showAsDropDown(moreBtn)

OK, 拿去玩耍 ~

Ad

我的动漫礼品淘宝店 ,希望亲能收藏下(单):

二维码

toprightmenu's People

Contributors

zaaach avatar

Watchers

James Cloos avatar 萌太浪 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.