Skip to content

leifu1107/CustomToast

Repository files navigation

CustomToast

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

效果图

如何使用


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!");