简介:基于 toasty,单例化,简化 api,添加 debug 模式,以及设置居中显示
更多:作者   提 Bug   


The usual Toast, but with steroids. (Screenshots at the end of the file.)


Toasty 内部维护单一的 toast 对象,防止弹出无数的 toast. 简化 api 调用

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        maven { url "" }


Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
    compile 'com.github.hss01248:Toasty:2.0.2'


Each method always returns a Toast object, so you can customize the Toast much more. no need to invoke the method "show()"

frist,init in Application:

     * @param context applicationcontext
     * @param isDebug 是测试环境还是正式环境
     * @param showInCenter 显示在什么地方.默认在底部,可以设置为屏幕中央.全局起作用
    public static void init(Context context,boolean isDebug,boolean showInCenter)

To display an error Toast:

 MyToast.error("This is an error toast.")

To display a success Toast:


To display an info Toast:"Here is some info for you.")

To display a warning Toast:

  MyToast.warn("Beware of the dog.")

To display the usual Toast:"Normal toast w/o icon")

To display the usual Toast with icon: text ,int resId)

diaplay some toast only in debug mode:

MyToast.debug(CharSequence text )

You can also create your custom Toasts with the custom() method:

Toasty.custom(yourContext, "I'm a custom Toast", yourIconDrawable, textColor, tintColor, duration, withIcon, true).show();


You can pass formatted text to Toasty!

There are variants of each method, feel free to explore this library.

Apps using Toasty

Want to be here? Open an issue or make a pull request.

ChromoPhoto - Colorize B&W
AutoTagger - редактор тегов.
ColorHub - Color Palette


Android 开发经验分享
C 轮融资近 30 亿元理财推荐
Android 开发经验分享
C 轮融资近 30 亿元理财推荐