Giter Club home page Giter Club logo

bottomdialog's Introduction

BottomDialog

BottomDialog 一个自定义的从底部弹出的dialog,仿照微博的分享弹框

效果图

Alt text Alt text

导入

compile 'top.zibin:BottomDialog:1.0.5'

#Release Notes ###v1.0.5, 2016/10/21

  • 修改多行显示下只有最后一行点击有相应问题

使用

BottomDialog 只需要一句代码即可轻松显示底部弹框

创建Menu

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/moments"
        android:icon="@mipmap/ic_share_moments"
        android:title="@string/moments" />
</menu>

设置 Layout 样式

new BottomDialog(MainActivity.this)
    .title(R.string.title_item)             //设置标题
    .layout(BottomDialog.GRID)              //设置内容layout,默认为线性(LinearLayout)
    .orientation(BottomDialog.VERTICAL)     //设置滑动方向,默认为横向
    .inflateMenu(R.menu.menu_share)         //传人菜单内容
    .itemClick(new OnItemClickListener() {  //设置监听
        @Override
        public void click(Item item) {
            Toast.makeText(MainActivity.this, getString(R.string.share_title) + item.getTitle(), Toast.LENGTH_LONG).show();
        }
    })
    .show();

Listener 事件监听方式调用

new BottomDialog(context)
    .title(R.string.share_title)
    .inflateMenu(R.menu.menu_share)
    .itemClick(new OnItemClickListener() {
        @Override
        public void click(Item item) {
                //TODO 处理点击结果
            }
        })
    .show();

bottomdialog's People

Stargazers

 avatar

Watchers

 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.