GlobalDialog框架使用教程

《GlobalDialog框架使用教程》 请勿模仿。

GlobalDialog是由
ITalk应用开源的一款全局对话框库。相比于Android原生对话框的繁琐配置,GlobalDialog的优势在于能够快速实现
全局对话框的功能(通知账号下线、通知账号异常等)。进一步了解,请访问笔者的
Github

集成方法

在Module的build.gradle文件中添加如下依赖即可。

compile 'com.txm.topcodes.globaldialog:globaldialog:0.1.6'

调用方式

常规方式:

new GlobalDialog.Builder()
                .setContext(context) 
                .setDescription("hello world") //弹出框的提示信息。
                .setStyle(GlobalDialog.Style.SingleAlert) //弹窗的样式。有DoubleAlert、SingleAlert两种,默认为后者。
                .setForce(ture) //设置弹框销毁的策略。默认为true。
                .setDialogClickListener(new OnDialogClickListener() { //设置回调,也可以不设置。
                    @Override
                    public void onSure() {
                        super.onSure();
                    }
                }).build().show();

精简方式:

new GlobalDialog.Builder()
                .setContext(context) 
                .setDescription("hello world") 
                .build().show();

FAQ

我发现GlobalDialog还存在BUG?
GlobalDialog是一个完全开源的框架,如果您在使用过程中发现问题,欢迎在笔者的GitHub创建一个Issue

我是Eclipse用户,可以使用GlobalDialog么?
不可以。

我在Android studio中链接GlobalDialog库失败了?
确保您的工程使用的远程仓库为jcenter。

allprojects {
    repositories {
        jcenter()
    }
}
    原文作者:唐先明
    原文地址: https://www.jianshu.com/p/d0f3e9705860
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞