Giter Site home page Giter Site logo

iosdialog's Introduction

IOSDialogDemo


一、简介

Android 仿IOS的 Dialog,包括 BottomSheetDialog 和 AlertDialog

屏幕演示截图保存在 images文件夹

动图演示如下:

动图演示效果

二、使用方法

0. 引用方法

此库并没有传到 gradle 仓库里面去,如果不想引入源码可以直接引入aar包,生成aar的方式。 双击下图中的 assemble :

aar生成方式

然后生成的aar在 IOSDialogDemo/lib-ios-dialog/build/outputs/aar 里面

1. AlertDialog

AlertDialog

        new AlertDialog(SimpleActivity.this)
                .init()
                .setTitle("退出当前账号")
                .setMsg("再连续登陆15天,就可变身为QQ达人。退出QQ可能会使你现有记录归零,确定退出?")
                .setPositiveButton("确认退出", new OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                })
                .setNegativeButton("取消", new OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                }).show();

2. BottomSheetDialog

AlertDialog

        new BottomSheetDialog(SimpleActivity.this)
                .init()
                .setTitle("这个是 BottomSheetDialog 的title ")
                .setCancelable(false)    //设置手机返回按钮是否有效
                .setCanceledOnTouchOutside(false)  //设置 点击空白处是否取消 Dialog 显示
                //如果条目样式一样,可以直接设置默认样式
                .setDefaultItemStyle(new BottomSheetDialog.SheetItemTextStyle("#000000", 16))
                .setBottomBtnStyle(new BottomSheetDialog.SheetItemTextStyle("#ff0000", 18))
                .addSheetItem("条目一",
                        //可以对一个条目单独设置字体样式
                        new BottomSheetDialog.SheetItemTextStyle("#ff00ff"),   //设置字体样式
                        new OnSheetItemClickListener() {
                            @Override
                            public void onClick(int which) {
                                Toast.makeText(SimpleActivity.this,
                                        "item" + which, Toast.LENGTH_SHORT)
                                        .show();
                            }
                        })
                .addSheetItem("条目二",
                        new OnSheetItemClickListener() {
                            @Override
                            public void onClick(int which) {
                                Toast.makeText(SimpleActivity.this,
                                        "item" + which, Toast.LENGTH_SHORT)
                                        .show();
                            }
                        })
                .addSheetItem("条目三",
                        new OnSheetItemClickListener() {
                            @Override
                            public void onClick(int which) {
                                Toast.makeText(SimpleActivity.this,
                                        "item" + which, Toast.LENGTH_SHORT)
                                        .show();
                            }
                        })
                .show();


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.