自定义toast提示,可设置,做了封装

CustomToast

自定义toast提示,可设置,做了封装
github地址:https://github.com/leifu1107/CustomToast

效果图

如何使用


Step 1.添加依赖

项目的 build.gradle 添加

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

/app/build.gradle

dependencies {
        compile 'com.github.leifu1107:CustomToast:1.0'
}

Step 2.建议在Application中初始化

**
 * 创建人: 雷富
 * 创建时间: 2018/1/31 17:01
 * 描述:
 */

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        CustomToast.init(this);
    }
}

Step 3.Activity中直接使用

CustomToast.error(“这是一个提示错误的Toast!”);
CustomToast.success(“这是一个成功Toast!);
CustomToast.info(“这是一个信息的Toast!”);
CustomToast.warning(“这是一个警告的Toast!”);
CustomToast.normal(“这是一个普通的Toast!”);

发布了13 篇原创文章 · 获赞 2 · 访问量 7400

猜你喜欢

转载自blog.csdn.net/qq_37165429/article/details/79220499
今日推荐